将几何设置为全屏

时间:2019-06-12 10:57:56

标签: c# wpf

我正在尝试将几何图形设置为全屏显示,但是底部和右侧仍然存在未被覆盖的空间。

XAML视图

<Window x:Class="Example.Views.Example"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    Title="example" WindowStyle="None" WindowState="Maximized" AllowsTransparency="True"
    Opacity="1"
    Background="Transparent" MouseDown="Feast_MouseDown" MouseUp="Feast_MouseUp" MouseMove="Feast_MouseMove">
<Grid>
    <Canvas>
        <Path Stroke="Black" Fill="White" Opacity="0.35">
            <Path.Data>
                <CombinedGeometry GeometryCombineMode="Exclude">
                    <CombinedGeometry.Geometry1>
                        <RectangleGeometry Rect="{Binding DetailRect}" />
                    </CombinedGeometry.Geometry1>
                    <CombinedGeometry.Geometry2>
                        <RectangleGeometry Rect="{Binding SecondRect}" />
                    </CombinedGeometry.Geometry2>
                </CombinedGeometry>
            </Path.Data>
        </Path>
    </Canvas>
</Grid>

将Rect设置为屏幕大小:

DetailRect = new Rect(SystemInformation.VirtualScreen.Left, SystemInformation.VirtualScreen.Top, SystemInformation.VirtualScreen.Width, SystemInformation.VirtualScreen.Height);

0 个答案:

没有答案