次の方法で共有


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

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

使用例

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

[xaml]

Extensible Application Markup Language (XAML) では、属性の構文を使用してパスを記述できます。

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

[xaml]

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

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>

この例は、より大きなサンプルの一部です。 サンプル全体については、ジオメトリのサンプルを参照してください。

参照

処理手順

方法 : 2 次ベジエ曲線を作成する

方法 : 3 次ベジエ曲線を作成する