【发布时间】:2012-02-07 18:45:08
【问题描述】:
我有一个在窗口中动态绘制的矩形。所述窗口具有不透明度设置为 0.4 的背景。 我想让矩形内的区域完全透明(看看窗口后面是什么)。
有什么办法吗?
这是我的窗口的代码:
<Window x:Class="TakeAScreenzone"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="PloofTAS" Height="355" Width="539" Topmost="True"
ResizeMode="NoResize" AllowsTransparency="True"
ShowInTaskbar="False" ShowActivated="True" WindowStyle="None" Background="#66FFFFFF" >
<Grid Name="Grid1"></Grid>
</Window>
这里是我用来绘制矩形的代码(其中 Grid1 是我窗口的主网格):
WorkingRectangle = New Rectangle
WorkingRectangle.Stroke = New SolidColorBrush(Colors.Red)
WorkingRectangle.StrokeThickness = 1
WorkingRectangle.Fill = Nothing
WorkingRectangle.HorizontalAlignment = Windows.HorizontalAlignment.Left
WorkingRectangle.VerticalAlignment = Windows.VerticalAlignment.Top
Grid1.Children.Add(WorkingRectangle)
【问题讨论】:
-
窗口不透明度为40%,还是矩形?
-
窗口的背景颜色。我正在尝试使用与 windows 内的快照工具相同的渲染。