Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/265.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 当全屏窗口被激活时,如何防止浏览器窗口覆盖任务栏?_C#_.net_Wpf - Fatal编程技术网

C# 当全屏窗口被激活时,如何防止浏览器窗口覆盖任务栏?

C# 当全屏窗口被激活时,如何防止浏览器窗口覆盖任务栏?,c#,.net,wpf,C#,.net,Wpf,我有一个全屏窗口,它在激活时处于最大化状态,如果浏览器窗口打开并拖到任务栏后面的底部,它会覆盖任务栏,如图所示 这是我的窗口代码: <Window x:Class="Forms.DrawingWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

我有一个全屏窗口,它在激活时处于最大化状态,如果浏览器窗口打开并拖到任务栏后面的底部,它会覆盖任务栏,如图所示

这是我的窗口代码:

    <Window x:Class="Forms.DrawingWindow"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Name="drawingWindow"
    ShowInTaskbar="False"
    AllowsTransparency="True"
    WindowStyle="None"
    Background="Transparent"
    Cursor="Cross"
    MouseDown="Window_MouseDown"
    MouseMove="Window_MouseMove"
    KeyDown="Window_KeyDown"
    Topmost="False" MouseLeftButtonUp="Window_PreviewMouseLeftButtonUp" WindowState="Maximized">
<Grid>
    <Border Background="Black" Opacity="0.1" x:Name="fill"></Border>
    <Canvas x:Name="cnv" Background="Transparent">
        <Border x:Name="rect" Background="#19FFFFFF" Height="0" Width="0">
            <TextBlock x:Name="cords" Text="" Foreground="LightGray" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0" FontFamily="Open Sans" FontWeight="Bold" FontSize="10" />
        </Border>
    </Canvas>
</Grid>

.cs代码中没有什么特别之处,只有这个.Show();
问题是如何防止资源管理器窗口在任务栏后面时覆盖任务栏?

这可能是您想要的。它在不隐藏任务栏的情况下创建“最大化”窗口

 FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
        Left = Top = 0;
        Width = Screen.PrimaryScreen.WorkingArea.Width;
        Height = Screen.PrimaryScreen.WorkingArea.Height;

这不是一张表格,而是一扇窗户。窗口没有FormBorderStyle。顺便说一下,我需要我的窗口覆盖任务栏,而不是像图中那样的其他打开的资源管理器窗口。您可以在底部图像中看到“我的窗口”覆盖了透明的所有内容。@Rahul Ranjan:这是Windows窗体代码。这是一个WPF问题。@d4mn这意味着您希望WPF窗口始终保持在顶部吗?是的。但这不是问题所在。问题是,当我的窗口被激活时,其他浏览器窗口会像图片一样覆盖任务栏。