Reputation: 11760
How can I create a ellipse (path, ...) with a hole in it:
The task is to create a visualization of a three-state-indicator. The different states are visualized by rotating the control several degrees to the left or the right.
Upvotes: 3
Views: 851
Reputation: 14391
You can use the CombinedGeometry with the GeometryCombineMode="Exclude"
The documentation has a good example.
Upvotes: 0
Reputation: 7591
=>
<Path Stroke="Red" StrokeThickness="20">
<Path.Data>
<PathGeometry>
<PathFigure StartPoint="80,0">
<ArcSegment x:Name="ArcSeg1" Size="100,100" RotationAngle="0" IsLargeArc="True"
SweepDirection="Clockwise" Point="20,0" >
</ArcSegment>
</PathFigure>
</PathGeometry>
</Path.Data>
</Path>
There are a few relevant properties here, to understand the math behind it see
http://www.charlespetzold.com/blog/2008/01/Mathematics-of-ArcSegment.html
But basically you're giving the coordinates of the intersection of two ellipses :
StartPoint and Point represents the intersecting points, While Size is the size of the full ellipse. The rest is pretty self explanatory. If you want to rotate it, the easiest and best way would be to use RotateTransform.
Upvotes: 3
Reputation: 24988
Would making the 'hole' a white triangle on to of the full circle help? This could be rotated around the center of the circle in conjunction with the 'pointer' (the line).
Upvotes: 0