2011-02-22 2 views
2

ArcSegment를 특정 방향으로 그리는 방법이 있습니까? 내가 말할 수있는 한, 항상 맨 아래에서 맨 위로 그림을 그립니다. 예를 들어, 이 180도 (270도 북쪽)에서으로 시작하고 거의 타원을 180 도로 그려주는 ArcSegment가 있습니다. 바로 지금 드로잉은 시계 방향으로 .... 음, 죄송합니다, 보여 드리겠습니다.ArcSegment의 회전 및 방향

things

좌측 하나는 내가 값의 변환 세트에서받는 값이지만, 나는 오른쪽처럼 행동 할 필요가있다.

<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 축으로 작동하기 때문에 어떤 영향을 미칠 것 같지 않습니다.

첫 번째 경로의 값은 변환 루틴에서 가져온 값이므로 쉽게 수정할 수 있습니다.

답변

1

X 축 대신 Y 축을 짧게 만듭니다. 그래서 :

<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> 

한 간단.