ArcSegment的旋转和方向
问题描述:
有没有办法让ArcSegment在特定的方向绘制?据我所知,它总是从上到下。例如,我有一个ArcSegment,其中在180度(270度为北)时开始,并将几乎椭圆绘制到180度。现在,绘图顺时针从....顺便说一句,对不起,让我给你看看。ArcSegment的旋转和方向
左边的一个是我从一个转换设定值接收的值,但我需要它像右边的一个行动。
<Canvas Background="#FDB" Width="720" Height="540">
<Path Canvas.Left="100" Canvas.Top="100" Stroke="#385D8A" StrokeThickness="2" StrokeLineJoin="Round" Fill="#4F81BD">
<!-- this is the LEFT shape that I need drawn like the other one -->
<Path.Data>
<GeometryGroup>
<PathGeometry>
<PathGeometry.Figures>
<PathFigure StartPoint="0,51" IsClosed="True">
<PathFigure.Segments>
<LineSegment Point="51,51" />
</PathFigure.Segments>
</PathFigure>
<PathFigure StartPoint="25.5,0">
<PathFigure.Segments>
<LineSegment Point="25.5,102" />
</PathFigure.Segments>
</PathFigure>
<PathFigure StartPoint="25.5,51" IsClosed="True" >
<PathFigure.Segments>
<ArcSegment Size="25.5,25.5" IsLargeArc="True" SweepDirection="Clockwise" Point="25.49,51" />
</PathFigure.Segments>
</PathFigure>
</PathGeometry.Figures>
</PathGeometry>
</GeometryGroup>
</Path.Data>
</Path>
<Path Canvas.Left="200" Canvas.Top="100" Stroke="#385D8A" StrokeThickness="2" StrokeLineJoin="Round" Fill="#4F81BD">
<!-- this is the RIGHT shape, the way it should behave, but notice the different StartPoint and Point -->
<Path.Data>
<GeometryGroup>
<PathGeometry>
<PathGeometry.Figures>
<PathFigure StartPoint="0,51" IsClosed="True">
<PathFigure.Segments>
<LineSegment Point="51,51" />
</PathFigure.Segments>
</PathFigure>
<PathFigure StartPoint="25.5,0">
<PathFigure.Segments>
<LineSegment Point="25.5,102" />
</PathFigure.Segments>
</PathFigure>
<PathFigure StartPoint="51,25.5" IsClosed="True" >
<PathFigure.Segments>
<ArcSegment Size="25.5,25.5" IsLargeArc="True" SweepDirection="Clockwise" Point="50.99,25.5" />
</PathFigure.Segments>
</PathFigure>
</PathGeometry.Figures>
</PathGeometry>
</GeometryGroup>
</Path.Data>
</Path>
</Canvas>
我试着RotationAngle
玩弄左右,但似乎并没有产生任何影响,因为它仅适用于X轴,而不是Y轴。
第一个Path的值来自转换例程,所以并不是我可以轻松修改它们。
答
我想我已经想通了 - 只需要缩短Y轴而不是X轴。所以:
<PathFigure StartPoint="51,25.5" IsClosed="True" >
<PathFigure.Segments>
<ArcSegment Point="50.99,25.5" Size="25.5,25.5" IsLargeArc="True" SweepDirection="Clockwise" />
</PathFigure.Segments>
</PathFigure>
应该是:
<PathFigure StartPoint="51,25.5" IsClosed="True" >
<PathFigure.Segments>
<ArcSegment Point="51,24.99" Size="25.5,25.5" IsLargeArc="True" SweepDirection="Clockwise" />
</PathFigure.Segments>
</PathFigure>
至于这么简单。