Export (0) Print
Expand All

GraphicsPath.SetMarkers Method

Sets a marker on this GraphicsPath.

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

public void SetMarkers ()
public void SetMarkers ()
public function SetMarkers ()
Not applicable.

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

Windows 98, Windows Server 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

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2015 Microsoft