GraphicsPath.CloseFigure Methode

Definitie

Hiermee sluit u de huidige afbeelding en begint u een nieuwe afbeelding. Als de huidige afbeelding een reeks verbonden lijnen en curven bevat, sluit de methode de lus door een lijn van het eindpunt met het beginpunt te verbinden.

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

Voorbeelden

Het volgende codevoorbeeld is ontworpen voor gebruik met Windows Forms en vereist PaintEventArgse, een OnPaint-gebeurtenisobject. De code maakt een driehoek door een nieuw pad te maken, een afbeelding te starten, twee kruislijnen aan de afbeelding toe te voegen en vervolgens de afbeelding te sluiten om een driehoek te vormen. Het pad wordt vervolgens getekend op het scherm.

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

Van toepassing op