如何在全屏窗口激活时阻止资源管理器窗口覆盖任务栏?

时间:2015-02-05 14:24:33

标签: c# .net wpf

我有一个FullScreen窗口,当它被激活时处于最大化状态,如果有一个浏览器窗口被打开并拖到任务栏后面的底部,它会覆盖任务栏,如下图所示enter image description here

这是我的窗口代码:

    <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代码没有什么特别之处只有this.Show(); 问题是当它们落后于任务栏时如何防止探索者窗口覆盖它?

1 个答案:

答案 0 :(得分:0)

这可能是你想要的。它创建了一个“最大化”窗口而不隐藏任务栏。

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