GraphicsPath.SetMarkers Méthode

Définition

Définit un marqueur sur ce GraphicsPath.

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

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 crée un chemin d’accès et ajoute plusieurs primitives au chemin d’accès séparés par des marqueurs, puis dessine le chemin d’accès à l’écran.

private:
   void SetMarkersExample( PaintEventArgs^ e )
   {
      // Create a path and set two markers.
      GraphicsPath^ myPath = gcnew GraphicsPath;
      myPath->AddLine( Point(0,0), Point(50,50) );
      myPath->SetMarkers();
      Rectangle rect = Rectangle(50,50,50,50);
      myPath->AddRectangle( rect );
      myPath->SetMarkers();
      myPath->AddEllipse( 100, 100, 100, 50 );

      // Draw the path to screen.
      e->Graphics->DrawPath( gcnew Pen( Color::Black,2.0f ), myPath );
   }
private void SetMarkersExample(PaintEventArgs e)
{
             
    // Create a path and set two markers.
    GraphicsPath myPath = new GraphicsPath();
    myPath.AddLine(new Point(0, 0), new Point(50, 50));
    myPath.SetMarkers();
    Rectangle rect = new Rectangle(50, 50, 50, 50);
    myPath.AddRectangle(rect);
    myPath.SetMarkers();
    myPath.AddEllipse(100, 100, 100, 50);
             
    // Draw the path to screen.
    e.Graphics.DrawPath(new Pen(Color.Black, 2), myPath);
}
Public Sub SetMarkersExample(ByVal e As PaintEventArgs)

    ' Create a path and set two markers.
    Dim myPath As New GraphicsPath
    myPath.AddLine(New Point(0, 0), New Point(50, 50))
    myPath.SetMarkers()
    Dim rect As New Rectangle(50, 50, 50, 50)
    myPath.AddRectangle(rect)
    myPath.SetMarkers()
    myPath.AddEllipse(100, 100, 100, 50)

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

Remarques

Cette méthode crée un marqueur sur le chemin qui peut être utilisé pour séparer les sections du chemin. Vous pouvez ensuite utiliser les NextMarker méthodes pour itérer au sein des marqueurs du 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 dans le chemin.

S’applique à