我需要将一些绘图(三角形和圆形)作为一个对象(将其设置为内容)。三角形应该填充,圆形不应该填充颜色。问题是 EllipseGeometry 没有 IsFilled 属性。如果我删除 Path 的 Fill 属性,则两者都不会被填充。我怎样才能填充 PathFigure 而不是填充 Ellipse 让它们都在一个 Path parent 中?
<Path Stroke="#FFF633FF"
StrokeThickness="1"
Fill="#FFF633FF">
<Path.Data>
<GeometryGroup>
<EllipseGeometry Center="6,0"
RadiusX="4"
RadiusY="4">
</EllipseGeometry>
<PathGeometry >
<PathGeometry.Figures>
<PathFigure StartPoint="6,-15"
IsClosed="True">
<LineSegment Point="1,-25" />
<LineSegment Point="11,-25" />
</PathFigure>
</PathGeometry.Figures>
</PathGeometry>
</GeometryGroup>
</Path.Data>
</Path>
最佳答案
一个简单的技巧是将 EllipseGeometry 替换为具有两个 ArcSegment 的非填充 PathGeometry:
<PathGeometry >
<PathGeometry.Figures>
<PathFigure StartPoint="2,0" IsFilled="False">
<ArcSegment Point="10,0" Size="4,4" />
<ArcSegment Point="2,0" Size="4,4" />
</PathFigure>
</PathGeometry.Figures>
</PathGeometry>
关于wpf - 填充 EllipseGeometry,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33565185/