GraphicsPath.SetMarkers Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Sets a marker on this GraphicsPath.
public:
void SetMarkers();
public void SetMarkers ();
member this.SetMarkers : unit -> unit
Public Sub SetMarkers ()
The following code example is designed for use with Windows Forms, and it requires PaintEventArgs e
, 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 );
}
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);
}
Public Sub SetMarkersExample(ByVal e As PaintEventArgs)
' Create a path and set two markers.
Dim myPath As New GraphicsPath
myPath.AddLine(New Point(0, 0), New Point(50, 50))
myPath.SetMarkers()
Dim rect As 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)
End Sub
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.
Product | Versions |
---|---|
.NET | 8 (package-provided), 9 (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 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: