Freigeben über


Graphics.DrawPath-Methode

Zeichnet einen GraphicsPath.

Namespace: System.Drawing
Assembly: System.Drawing (in system.drawing.dll)

Syntax

'Declaration
Public Sub DrawPath ( _
    pen As Pen, _
    path As GraphicsPath _
)
'Usage
Dim instance As Graphics
Dim pen As Pen
Dim path As GraphicsPath

instance.DrawPath(pen, path)
public void DrawPath (
    Pen pen,
    GraphicsPath path
)
public:
void DrawPath (
    Pen^ pen, 
    GraphicsPath^ path
)
public void DrawPath (
    Pen pen, 
    GraphicsPath path
)
public function DrawPath (
    pen : Pen, 
    path : GraphicsPath
)

Parameter

  • pen
    Pen, der die Farbe, Breite und den Stil des Pfades bestimmt.

Ausnahmen

Ausnahmetyp Bedingung

ArgumentNullException

pen ist NULL (Nothing in Visual Basic).

- oder -

path ist NULL (Nothing in Visual Basic).

Hinweise

Die aktuelle Transformation im Grafikkontext wird auf den GraphicsPath angewendet, bevor dieser gezeichnet wird.

Beispiel

Das folgende Codebeispiel ist für die Verwendung mit Windows Forms vorgesehen und erfordert PaintEventArgse, wobei es sich um einen Parameter des Paint-Ereignishandlers handelt. Der Code führt die folgenden Aktionen aus:

  • Erstellt ein Grafikpfadobjekt und fügt diesem eine Ellipse hinzu.

  • Erstellt einen schwarzen Stift.

  • Zeichnet den Grafikpfad auf dem Bildschirm.

Public Sub DrawPathEllipse(ByVal e As PaintEventArgs)

    ' Create graphics path object and add ellipse.
    Dim graphPath As New GraphicsPath
    graphPath.AddEllipse(0, 0, 200, 100)

    ' Create pen.
    Dim blackPen As New Pen(Color.Black, 3)

    ' Draw graphics path to screen.
    e.Graphics.DrawPath(blackPen, graphPath)
End Sub
public void DrawPathEllipse(PaintEventArgs e)
{
             
    // Create graphics path object and add ellipse.
    GraphicsPath graphPath = new GraphicsPath();
    graphPath.AddEllipse(0, 0, 200, 100);
             
    // Create pen.
    Pen blackPen = new Pen(Color.Black, 3);
             
    // Draw graphics path to screen.
    e.Graphics.DrawPath(blackPen, graphPath);
}
public:
   void DrawPathEllipse( PaintEventArgs^ e )
   {
      // Create graphics path object and add ellipse.
      GraphicsPath^ graphPath = gcnew GraphicsPath;
      graphPath->AddEllipse( 0, 0, 200, 100 );

      // Create pen.
      Pen^ blackPen = gcnew Pen( Color::Black,3.0f );

      // Draw graphics path to screen.
      e->Graphics->DrawPath( blackPen, graphPath );
   }
public void DrawPathEllipse(PaintEventArgs e) 
{
    // Create graphics path object and add ellipse.
    GraphicsPath graphPath =  new GraphicsPath();
    graphPath.AddEllipse(0, 0, 200, 100);

    // Create pen.
    Pen blackPen =  new Pen(Color.get_Black(), 3);

    // Draw graphics path to screen.
    e.get_Graphics().DrawPath(blackPen, graphPath);
} //DrawPathEllipse

Plattformen

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

Graphics-Klasse
Graphics-Member
System.Drawing-Namespace