[英]Making a transparent hole in an overlay WPF
您可以設置overlay元素的Clip
屬性(例如下面的Rectangle)。 請注意,疊加層必須在其他元素之上。
<Grid>
<TextBlock Margin="80,80" Text="Some Text" FontSize="32"/>
<Rectangle Fill="Black" Opacity="0.7">
<Rectangle.Clip>
<CombinedGeometry GeometryCombineMode="Exclude">
<CombinedGeometry.Geometry1>
<RectangleGeometry Rect="0,0,10000,10000"/>
</CombinedGeometry.Geometry1>
<CombinedGeometry.Geometry2>
<EllipseGeometry Center="100,100" RadiusX="50" RadiusY="50"/>
</CombinedGeometry.Geometry2>
</CombinedGeometry>
</Rectangle.Clip>
</Rectangle>
</Grid>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.