Share via


GraphicsPath.CloseFigure Yöntem

Tanım

Geçerli şekli kapatır ve yeni bir şekil başlatır. Geçerli şekilde bağlı çizgiler ve eğriler dizisi varsa, yöntem uç noktadan başlangıç noktasına bir çizgi bağlayarak döngünün kapatılmasını sağlar.

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

Örnekler

Aşağıdaki kod örneği, Windows Forms ile kullanılmak üzere tasarlanmıştır ve bir OnPaint olay nesnesi gerektirir.PaintEventArgse Kod, yeni bir yol oluşturarak, bir şekil başlatarak, şekle iki kesişen çizgi ekleyerek ve sonra üçgen oluşturmak için şekli kapatarak bir üçgen oluşturur. Ardından yol ekrana çizilir.

private:
   void CloseFigureExample( PaintEventArgs^ e )
   {
      // Create a path consisting of two, open-ended lines and close
      // the lines using CloseFigure.
      GraphicsPath^ myPath = gcnew GraphicsPath;
      myPath->StartFigure();
      myPath->AddLine( Point(10,10), Point(200,10) );
      myPath->AddLine( Point(200,10), Point(200,200) );
      myPath->CloseFigure();

      // Draw the path to the screen.
      e->Graphics->DrawPath( Pens::Black, myPath );
   }
private void CloseFigureExample(PaintEventArgs e)
{
             
    // Create a path consisting of two, open-ended lines and close
             
    // the lines using CloseFigure.
    GraphicsPath myPath = new GraphicsPath();
    myPath.StartFigure();
    myPath.AddLine(new Point(10, 10), new Point(200, 10));
    myPath.AddLine(new Point(200, 10), new Point(200, 200));
    myPath.CloseFigure();
             
    // Draw the path to the screen.
    e.Graphics.DrawPath(Pens.Black, myPath);
}
Public Sub CloseFigureExample(ByVal e As PaintEventArgs)

    ' Create a path consisting of two, open-ended lines and close

    ' the lines using CloseFigure.
    Dim myPath As New GraphicsPath
    myPath.StartFigure()
    myPath.AddLine(New Point(10, 10), New Point(200, 10))
    myPath.AddLine(New Point(200, 10), New Point(200, 200))
    myPath.CloseFigure()

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

Şunlara uygulanır