GraphicsPath.ClearMarkers Method
Definition
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.
Clears all markers from this path.
public:
void ClearMarkers();
public void ClearMarkers ();
member this.ClearMarkers : unit -> unit
Public Sub 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.
private:
void ClearMarkersExample( PaintEventArgs^ e )
{
// Set several markers in a path.
GraphicsPath^ myPath = gcnew GraphicsPath;
myPath->AddEllipse( 0, 0, 100, 200 );
myPath->SetMarkers();
myPath->AddLine( Point(100,100), Point(200,100) );
Rectangle rect = Rectangle(200,0,100,200);
myPath->AddRectangle( rect );
myPath->SetMarkers();
myPath->AddLine( Point(250,200), Point(250,300) );
myPath->SetMarkers();
// Clear the markers.
myPath->ClearMarkers();
// Draw the path to the screen.
Pen^ myPen = gcnew Pen( Color::Black,2.0f );
e->Graphics->DrawPath( myPen, myPath );
}
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);
}
Public Sub ClearMarkersExample(ByVal e As PaintEventArgs)
' Set several markers in a path.
Dim myPath As New GraphicsPath
myPath.AddEllipse(0, 0, 100, 200)
myPath.SetMarkers()
myPath.AddLine(New Point(100, 100), New Point(200, 100))
Dim rect As 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.
Dim myPen As New Pen(Color.Black, 2)
e.Graphics.DrawPath(myPen, myPath)
End Sub
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
.NET
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示