SetMarkers Method

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 = new GraphicsPath();
    myPath.AddLine(new Point(0, 0), new Point(50, 50));
    Rectangle rect = new Rectangle(50, 50, 50, 50);
    myPath.AddEllipse(100, 100, 100, 50);

    // Draw the path to screen.
    e.Graphics.DrawPath(new Pen(Color.Black, 2), myPath);

.NET Framework
Available since 1.1
Return to top
© 2015 Microsoft