Graphics.DrawPath(Pen, GraphicsPath) Método

Definición

Dibuja un GraphicsPath.

public:
 void DrawPath(System::Drawing::Pen ^ pen, System::Drawing::Drawing2D::GraphicsPath ^ path);
public void DrawPath (System.Drawing.Pen pen, System.Drawing.Drawing2D.GraphicsPath path);
member this.DrawPath : System.Drawing.Pen * System.Drawing.Drawing2D.GraphicsPath -> unit
Public Sub DrawPath (pen As Pen, path As GraphicsPath)

Parámetros

pen
Pen

Pen que determina el color, ancho y estilo del trazado.

path
GraphicsPath

GraphicsPath que se va a dibujar.

Excepciones

pen es null.

o bien

path es null.

Ejemplos

El ejemplo de código siguiente está diseñado para su uso con Windows Forms y requiere PaintEventArgse, que es un parámetro del Paint controlador de eventos. El código realiza las siguientes acciones:

  • Crea un objeto de ruta de acceso de gráficos y le agrega una elipse.

  • Crea un lápiz negro.

  • Dibuja la ruta de acceso de gráficos a la pantalla.

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.Black, 3);
             
    // Draw graphics path to screen.
    e.Graphics.DrawPath(blackPen, graphPath);
}
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

Comentarios

La transformación actual en el contexto gráfico se aplica a antes GraphicsPath de dibujarse.

Se aplica a