GraphicsPath.ClearMarkers Method

Definition

Clears all markers from this path.

C#
public void ClearMarkers();

Examples

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.

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

Remarks

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.

Applies to

Proizvod Verzije
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10