GraphicsPath.StartFigure メソッド

定義

現在の図形を閉じずに、新しい図形を開始します。 それ以降パスに追加されたすべての点は、この新しい図形に追加されます。

public:
 void StartFigure();
public void StartFigure ();
member this.StartFigure : unit -> unit
Public Sub StartFigure ()

次のコード例は、Windows フォームで使用するように設計されており、イベント オブジェクトがOnPaint必要PaintEventArgseです。 コードは、次のアクションを実行します。

  • パスを作成します。

  • 2 つの図形セットを追加します。 図の最初のセットは、4 つのプリミティブを 2 つの図形に結合します。 2 番目の図形セットは、同じ 4 つのプリミティブ (y 軸のオフセットを除く) を 3 つの図に結合します。

  • すべての図形を画面に描画します。

2 組のフィギュアの外観の違いに注目してください。

public:
   void StartFigureExample( PaintEventArgs^ e )
   {
      // Create a GraphicsPath object.
      GraphicsPath^ myPath = gcnew GraphicsPath;

      // First set of figures.
      myPath->StartFigure();
      myPath->AddArc( 10, 10, 50, 50, 0, 270 );
      myPath->AddLine( Point(50,0), Point(100,50) );
      myPath->AddArc( 50, 100, 75, 75, 0, 270 );
      myPath->CloseFigure();
      myPath->StartFigure();
      myPath->AddArc( 100, 10, 50, 50, 0, 270 );

      // Second set of figures.
      myPath->StartFigure();
      myPath->AddArc( 10, 200, 50, 50, 0, 270 );
      myPath->CloseFigure();
      myPath->StartFigure();
      myPath->AddLine( Point(60,200), Point(110,250) );
      myPath->AddArc( 50, 300, 75, 75, 0, 270 );
      myPath->CloseFigure();
      myPath->StartFigure();
      myPath->AddArc( 100, 200, 50, 50, 0, 270 );

      // Draw the path to the screen.
      e->Graphics->DrawPath( gcnew Pen( Color::Black ), myPath );
   }
   // End StartFigureExample
public void StartFigureExample(PaintEventArgs e)
{
             
    // Create a GraphicsPath object.
    GraphicsPath myPath = new GraphicsPath();
             
    // First set of figures.
    myPath.StartFigure();
    myPath.AddArc(10, 10, 50, 50, 0, 270);
    myPath.AddLine(new Point(50, 0), new Point(100, 50));
    myPath.AddArc(50, 100, 75, 75, 0, 270);
    myPath.CloseFigure();
    myPath.StartFigure();
    myPath.AddArc(100, 10, 50, 50, 0, 270);
             
    // Second set of figures.
    myPath.StartFigure();
    myPath.AddArc(10, 200, 50, 50, 0, 270);
    myPath.CloseFigure();
    myPath.StartFigure();
    myPath.AddLine(new Point(60, 200), new Point(110, 250));
    myPath.AddArc(50, 300, 75, 75, 0, 270);
    myPath.CloseFigure();
    myPath.StartFigure();
    myPath.AddArc(100, 200, 50, 50, 0, 270);
             
    // Draw the path to the screen.
    e.Graphics.DrawPath(new Pen(Color.Black), myPath);
} 
// End StartFigureExample
Public Sub StartFigureExample(ByVal e As PaintEventArgs)

    ' Create a GraphicsPath object.
    Dim myPath As New GraphicsPath

    ' First set of figures.
    myPath.StartFigure()
    myPath.AddArc(10, 10, 50, 50, 0, 270)
    myPath.AddLine(New Point(50, 0), New Point(100, 50))
    myPath.AddArc(50, 100, 75, 75, 0, 270)
    myPath.CloseFigure()
    myPath.StartFigure()
    myPath.AddArc(100, 10, 50, 50, 0, 270)

    ' Second set of figures.
    myPath.StartFigure()
    myPath.AddArc(10, 200, 50, 50, 0, 270)
    myPath.CloseFigure()
    myPath.StartFigure()
    myPath.AddLine(New Point(60, 200), New Point(110, 250))
    myPath.AddArc(50, 300, 75, 75, 0, 270)
    myPath.CloseFigure()
    myPath.StartFigure()
    myPath.AddArc(100, 200, 50, 50, 0, 270)

    ' Draw the path to the screen.
    e.Graphics.DrawPath(New Pen(Color.Black), myPath)
End Sub

注釈

ユーザーは、必要に応じて元のポイントを保持する必要があります。 元のポイントは内部的に 3 次ベジエコントロール ポイントに変換されるため、元のポイントを返すメカニズムはありません。

このメソッドは、パス内の新しいサブパスを開始します。 サブパスを使用すると、パスをセクションに分割し、 クラスを GraphicsPathIterator 使用してサブパスを反復処理できます。

適用対象