我正在尝试制作一个小型屏幕截图程序,我正在制作一个带边框的小型 WPF 窗口。这应该起到“视口”的作用,因此窗口内(边框内)的所有内容都应该是屏幕截图。然而,当我将窗口的透明度设置为 0 时,我看不到边框。关于如何使我的网格完全透明,并且仍然保留周围 2 像素的黑色边框,有什么想法吗?
不确定您是否想要窗口或只是网格透明并带有边框。
这会在窗口周围绘制边框:
<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525"
AllowsTransparency="True"
WindowStyle="None"
Background="Transparent"
BorderThickness="2"
BorderBrush="Black">
<Grid>
</Grid>
</Window>
这仅在网格周围绘制边框:
<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525" AllowsTransparency="True" WindowStyle="None" Background="Transparent">
<Border BorderThickness="2" BorderBrush="Black">
<Grid>
</Grid>
</Border>
</Window>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)