GraphicsPath.ClearMarkers 方法

定义

清除此路径的所有标记。Clears all markers from this path.

public:
 void ClearMarkers();
public void ClearMarkers ();
member this.ClearMarkers : unit -> unit
Public Sub ClearMarkers ()

示例

下面的代码示例旨在与 Windows 窗体一起使用,并且它需要 PaintEventArgs e 一个 OnPaint 事件对象。The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, 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

注解

使用 SetMarkers 方法在中的当前位置创建标记 GraphicsPathUse the SetMarkers method to create a marker at the current location in a GraphicsPath. 使用 NextMarker 方法可循环访问路径中的现有标记。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.

适用于