如何在WPF中透明椭圆 [英] How to transparent ellipse in WPF
问题描述
如何透明椭圆像Window允许透明度。
我尝试过:
how to transparent Ellipse like Window AllowsTransparency.
What I have tried:
<grid>
<ellipse name="eelipse">
Stretch="Fill"
Fill="Transparent"
Stroke="Bisque"
StrokeThickness="2"
</ellipse>
</grid>
透明窗口不完全透明。 AllowTransparency =true显示完整透明窗口,我希望只有部分椭圆可以完全透明。
请帮助我。
This transparent for window not full transparent . AllowsTransparency="true" show you full transparent window like i want to only part of ellipse can full transparent.
Please help me.
推荐答案
首先设置为窗口
first set to window
AllowsTransparency="True" WindowStyle="None"
<Window.Background >
<SolidColorBrush x:Name="BackgroundBrush" Color="BlanchedAlmond" Opacity="0" ></SolidColorBrush>
</Window.Background>
绘制带填充颜色的矩形并在此矩形中绘制椭圆
< Path Stroke =BlackStrokeThickness =5Fill =WhiteSmokeOpacity =100>
< Path .Data>
< CombinedGeometry GeometryCombineMode =Xor>
< CombinedGeometry.Geometry1>
< RectangleGeometry Rect =0 ,0,600,700/>
< /CombinedGeometry.Geometry1>
< CombinedGeometry。 Geometry2>
< EllipseGeometry RadiusX =300RadiusY =300Center =300,300/>
< /CombinedGeometry.Geometry2>
< / CombinedGeometry>
< /Path.Data>
< / Path>
椭圆是完全透明的。
draw rectangle with fill color and in this rectangle draw ellipse
<Path Stroke="Black" StrokeThickness="5" Fill="WhiteSmoke" Opacity="100">
<Path.Data>
<CombinedGeometry GeometryCombineMode="Xor">
<CombinedGeometry.Geometry1>
<RectangleGeometry Rect="0,0,600,700" />
</CombinedGeometry.Geometry1>
<CombinedGeometry.Geometry2>
<EllipseGeometry RadiusX="300" RadiusY="300" Center="300,300" />
</CombinedGeometry.Geometry2>
</CombinedGeometry>
</Path.Data>
</Path>
ellipse is full transparent.
这篇关于如何在WPF中透明椭圆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!