Export (0) Print
Expand All

GraphicsPath.ClearMarkers Method

Clears all markers from this path.

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

public void ClearMarkers()

Use the SetMarkers method to create a marker at the current location in a GraphicsPath. Use the NextMarker method to iterate through the existing markers in a path.

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

The following code example is designed for use with Windows Forms, and it requires PaintEventArgs e, an OnPaint event object. The code performs the following actions:

  • Creates a path.

  • Adds several objects to the path.

  • Adds markers to the path.

  • Clears all markers from the path.

  • Draws the path to the screen.

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

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft