GraphicsPath.SetMarkers Metode
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mengatur penanda pada GraphicsPathini.
public:
void SetMarkers();
public void SetMarkers ();
member this.SetMarkers : unit -> unit
Public Sub SetMarkers ()
Contoh
Contoh kode berikut dirancang untuk digunakan dengan Windows Forms, dan memerlukan PaintEventArgse
, objek peristiwa OnPaint. Kode membuat jalur dan menambahkan beberapa primitif ke jalur yang dipisahkan oleh penanda, dan menggambar jalur ke layar.
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
Keterangan
Metode ini membuat penanda pada jalur yang dapat digunakan untuk memisahkan bagian jalur. Anda kemudian dapat menggunakan metode NextMarker untuk melakukan iterasi melalui penanda di jalur.
Penanda digunakan untuk memisahkan grup subpath. Satu atau beberapa subpath dapat dimuat di antara dua penanda di jalur.