Freigeben über


GraphicsPath.SetMarkers-Methode

Setzt einen Marker für diesen GraphicsPath.

Namespace: System.Drawing.Drawing2D
Assembly: System.Drawing (in system.drawing.dll)

Syntax

'Declaration
Public Sub SetMarkers
'Usage
Dim instance As GraphicsPath

instance.SetMarkers
public void SetMarkers ()
public:
void SetMarkers ()
public void SetMarkers ()
public function SetMarkers ()

Hinweise

Diese Methode erstellt einen Marker für den Pfad, mit dem einzelne Abschnitte des Pfads voneinander getrennt werden können. Sie können die Marker im Pfad mithilfe der NextMarker-Methode durchlaufen.

Marker werden verwendet, um Gruppen untergeordneter Pfade voneinander zu trennen. In einem Pfad können sich zwischen zwei Markern ein oder mehr untergeordnete Pfade befinden.

Beispiel

Das folgende Codebeispiel ist für die Verwendung mit Windows Forms vorgesehen und erfordert das OnPaint-Ereignisobjekt PaintEventArgse. Der Code erstellt einen Pfad, fügt diesem mehrere durch Marker getrennte geometrische Grundformen hinzu und zeichnet den Pfad auf dem Bildschirm.

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
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);
}
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.get_Graphics().DrawPath(new Pen(Color.get_Black(), 2), myPath);
} //SetMarkersExample

Plattformen

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

GraphicsPath-Klasse
GraphicsPath-Member
System.Drawing.Drawing2D-Namespace