次の方法で共有


GraphicsPath.ClearMarkers メソッド

パスからすべてのマーカーを消去します。

Public Sub ClearMarkers()
[C#]
public void ClearMarkers();
[C++]
public: void ClearMarkers();
[JScript]
public function ClearMarkers();

解説

SetMarkers メソッドを使用して、 GraphicsPath オブジェクトの現在の位置にマーカーを作成します。 NextMarker メソッドを使用して、パスの既存のマーカーを反復します。

マーカーは、サブパスのグループを区切るために使用されます。2 つのマーカー間には、1 つ以上のサブパスを含めることができます。

使用例

[Visual Basic, C#] 次の例は、Windows フォームでの使用を意図してデザインされており、 OnPaint イベントのオブジェクトである PaintEventArgs e が必要です。このコードは次のアクションを実行します。

  • パスを作成します。
  • パスに複数のオブジェクトを追加します。
  • パスにマーカーを追加します。
  • パスからすべてのマーカーを消去します。
  • 画面にパスを描画します。
 
Public Sub ClearMarkersExample(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
        
[C#] 
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);
}
        

[C++, JScript] C++ および JScript のサンプルはありません。Visual Basic および C# のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

GraphicsPath クラス | GraphicsPath メンバ | System.Drawing.Drawing2D 名前空間