GraphicsPath.ClearMarkers 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
清除這條路徑上的所有標記。
public:
void ClearMarkers();
public void ClearMarkers();
member this.ClearMarkers : unit -> unit
Public Sub ClearMarkers ()
範例
以下程式碼範例是為 Windows Forms 設計,並需要 PaintEventArgse,一個 OnPaint 事件物件。 此程式碼會執行下列動作:
開闢一條路徑。
會在路徑上增加幾個物件。
在路徑上增加標記。
清除路徑上的所有標記。
畫出通往螢幕的路徑。
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 方法在當前位置 GraphicsPath建立標記。 使用該 NextMarker 方法遍歷路徑中現有的標記。
標記用於分隔子路徑群組。 兩個標記之間可以包含一個或多個子路徑。