次の方法で共有


方法: 楕円円弧を作成する

この例では、楕円の円弧を描画する方法を示します。楕円円弧を作成するには、PathGeometryPathFigure、および ArcSegment クラスを使用します。

次の例では、楕円の円弧が (10,100) から (200,100) に描画されます。 この円弧では、Size が 100 × 50 (デバイス非依存ピクセル)、RotationAngle が 45 度、IsLargeArc の設定が trueSweepDirectionCounterclockwise です。

拡張アプリケーション マークアップ言語 (XAML) では、属性構文を使用してパスを記述できます。

<Path Stroke="Black" StrokeThickness="1"  
  Data="M 10,100 A 100,50 45 1 0 200,100" />

(この属性構文は、実際には StreamGeometryの軽量バージョンである PathGeometryを作成します。詳細については、「パス マークアップ構文 ページ」を参照してください。

XAML では、オブジェクト タグを明示的に使用して楕円の円弧を描画することもできます。 次は、上記の XAML マークアップと同じです。

<Path Stroke="Black" StrokeThickness="1">
  <Path.Data>
    <PathGeometry>
      <PathGeometry.Figures>
        <PathFigureCollection>
          <PathFigure StartPoint="10,100">
            <PathFigure.Segments>
              <PathSegmentCollection>
                <ArcSegment Size="100,50" RotationAngle="45" IsLargeArc="True" SweepDirection="CounterClockwise" Point="200,100" />
              </PathSegmentCollection>
            </PathFigure.Segments>
          </PathFigure>
        </PathFigureCollection>
      </PathGeometry.Figures>
    </PathGeometry>
  </Path.Data>
</Path>

この例は、より大きなサンプルの一部です。 完全なサンプルについては、Geometries サンプルを参照してください。

こちらも参照ください