GraphicsPath.SetMarkers メソッド

定義

この GraphicsPath にマーカーを設定します。

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

次のコード例は、Windows フォームで使用するように設計されており、イベント オブジェクトがOnPaint必要PaintEventArgseです。 このコードでは、パスを作成し、マーカーで区切られたパスにいくつかのプリミティブを追加し、画面へのパスを描画します。

private:
   void SetMarkersExample( PaintEventArgs^ e )
   {
      // Create a path and set two markers.
      GraphicsPath^ myPath = gcnew GraphicsPath;
      myPath->AddLine( Point(0,0), Point(50,50) );
      myPath->SetMarkers();
      Rectangle rect = Rectangle(50,50,50,50);
      myPath->AddRectangle( rect );
      myPath->SetMarkers();
      myPath->AddEllipse( 100, 100, 100, 50 );

      // Draw the path to screen.
      e->Graphics->DrawPath( gcnew Pen( Color::Black,2.0f ), myPath );
   }
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);
}
Public Sub SetMarkersExample(ByVal 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

注釈

このメソッドは、パスのセクションを区切るために使用できるマーカーをパスに作成します。 その後、メソッドを NextMarker 使用して、パス内のマーカーを反復処理できます。

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

適用対象