次の方法で共有


GraphicsPath.SetMarkers メソッド

GraphicsPath オブジェクトにマーカーを設定します。

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

解説

このメソッドは、パスの部分を区切るために使用するマーカーをパスに作成します。 NextMarker メソッドを使用すると、パス内でマーカーを反復できます。

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

使用例

[Visual Basic, C#] 次の例は、Windows フォームでの使用を意図してデザインされており、 OnPaint イベントのオブジェクトである PaintEventArgs e が必要です。このコードはパスを作成し、そのパスに複数のプリミティブをマーカーで区切りながら追加して、パスを画面に描画します。

 
Public Sub SetMarkersExample(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
        
[C#] 
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);
}
        

[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 名前空間