wpf 窗口全屏设置,全屏后在左边和顶部有条透明的间距


请输入图片描述

请输入图片描述

请看2张图片,我截取的全屏的图像,然后在wpf的窗口里有一个image控件.我这个窗口是没有标题栏的窗口,默认状态为最大化的.请仔细观看,在图片的左边和上边,还是有点边距,很恶心.我截取图像的时候是先获取全屏的图像的.
求帮忙,怎么去掉那个边距,谢谢!
下面是WPF代码:

   
  <Window x:Class="DllTest.Window3"
  
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window3" Height="300" Width="300" WindowStyle="None" Visibility="Visible" AllowsTransparency="True" WindowState="Maximized" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{x:Null}" Foreground="{x:Null}" MouseMove="Window_MouseMove" MouseUp="Window_MouseUp" MouseLeftButtonDown="Window_MouseLeftButtonDown">
<Grid Name="grid" HorizontalAlignment="Center" VerticalAlignment="Center" MouseRightButtonUp="Grid_MouseRightButtonUp">
<Image HorizontalAlignment="Left" Margin="12,12,0,0" Name="image1" Stretch="UniformToFill" VerticalAlignment="Top" />
</Grid>
</Window>

c# WPF

淒然D奈落 11 years, 10 months ago

Your Answer