GraphicsPath::SetMarkers Method ()

 

Sets a marker on this GraphicsPath.

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

public:
void SetMarkers()

This method creates a marker on the path that can be used to separate sections of the path. You can then use the NextMarker methods to iterate through the markers in the path.

Markers are used to separate groups of subpaths. One or more subpaths can be contained between two markers in the path.

The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, an OnPaint event object. The code creates a path and adds several primitives to the path separated by markers, and draws the path to the screen.

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 );
   }

.NET Framework
Available since 1.1
Return to top
Show: