GraphicsPath.ClearMarkers Méthode

Définition

Efface tous les marqueurs de ce tracé.

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

Exemples

L’exemple de code suivant est conçu pour être utilisé avec Windows Forms et nécessite PaintEventArgse, un objet d’événementOnPaint. Le code effectue les actions suivantes :

  • Crée un chemin d’accès.

  • Ajoute plusieurs objets au chemin d’accès.

  • Ajoute des marqueurs au chemin d’accès.

  • Efface tous les marqueurs du chemin d’accès.

  • Dessine le chemin d’accès à l’écran.

private:
   void ClearMarkersExample( PaintEventArgs^ e )
   {
      // Set several markers in a path.
      GraphicsPath^ myPath = gcnew GraphicsPath;
      myPath->AddEllipse( 0, 0, 100, 200 );
      myPath->SetMarkers();
      myPath->AddLine( Point(100,100), Point(200,100) );
      Rectangle rect = Rectangle(200,0,100,200);
      myPath->AddRectangle( rect );
      myPath->SetMarkers();
      myPath->AddLine( Point(250,200), Point(250,300) );
      myPath->SetMarkers();

      // Clear the markers.
      myPath->ClearMarkers();

      // Draw the path to the screen.
      Pen^ myPen = gcnew Pen( Color::Black,2.0f );
      e->Graphics->DrawPath( myPen, myPath );
   }
private void ClearMarkersExample(PaintEventArgs e)
{
             
    // Set several markers in a path.
    GraphicsPath myPath = new GraphicsPath();
    myPath.AddEllipse(0, 0, 100, 200);
    myPath.SetMarkers();
    myPath.AddLine(new Point(100, 100), new Point(200, 100));
    Rectangle rect = new Rectangle(200, 0, 100, 200);
    myPath.AddRectangle(rect);
    myPath.SetMarkers();
    myPath.AddLine(new Point(250, 200), new Point(250, 300));
    myPath.SetMarkers();
             
    // Clear the markers.
    myPath.ClearMarkers();
             
    // Draw the path to the screen.
    Pen myPen = new Pen(Color.Black, 2);
    e.Graphics.DrawPath(myPen, myPath);
}
Public Sub ClearMarkersExample(ByVal e As PaintEventArgs)

    ' Set several markers in a path.
    Dim myPath As New GraphicsPath
    myPath.AddEllipse(0, 0, 100, 200)
    myPath.SetMarkers()
    myPath.AddLine(New Point(100, 100), New Point(200, 100))
    Dim rect As New Rectangle(200, 0, 100, 200)
    myPath.AddRectangle(rect)
    myPath.SetMarkers()
    myPath.AddLine(New Point(250, 200), New Point(250, 300))
    myPath.SetMarkers()

    ' Clear the markers.
    myPath.ClearMarkers()

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

Remarques

Utilisez la SetMarkers méthode pour créer un marqueur à l’emplacement actuel dans un GraphicsPath. Utilisez la NextMarker méthode pour itérer à travers les marqueurs existants dans un chemin d’accès.

Les marqueurs sont utilisés pour séparer des groupes de sous-chemins. Un ou plusieurs sous-chemins peuvent être contenus entre deux marqueurs.

S’applique à