GraphicsPath.StartFigure 메서드

정의

현재 그림을 닫지 않고 새 그림을 시작합니다. 경로에 추가된 모든 후속 지점이 이 새 그림에 추가됩니다.

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

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 개체가 OnPaint 필요합니다 PaintEventArgs e. 코드는 다음 작업을 수행합니다.

  • 경로를 만듭니다.

  • 두 개의 그림 집합을 추가합니다. 첫 번째 그림 집합은 4개의 기본 형식을 두 개의 그림으로 결합합니다. 두 번째 그림 집합은 동일한 4개의 기본 형식(y축에서 오프셋됨 제외)을 세 개의 그림으로 결합합니다.

  • 화면에 모든 그림을 그립니다.

두 그림 집합 간의 모양 차이를 확인합니다.

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

설명

필요한 경우 원래 지점을 유지해야 합니다. 원래 점은 내부적으로 입방형 베지어 제어점으로 변환되므로 원래 점을 반환하는 메커니즘이 없습니다.

이 메서드는 경로에서 새 하위 경로를 시작합니다. 하위 경로를 사용하면 경로를 섹션으로 구분하고 클래스를 GraphicsPathIterator 사용하여 하위 경로를 반복할 수 있습니다.

적용 대상