Graphics.FillPath(Brush, GraphicsPath) Metodo

Definizione

Riempie l'area interna di un oggetto GraphicsPath.

public:
 void FillPath(System::Drawing::Brush ^ brush, System::Drawing::Drawing2D::GraphicsPath ^ path);
public void FillPath (System.Drawing.Brush brush, System.Drawing.Drawing2D.GraphicsPath path);
member this.FillPath : System.Drawing.Brush * System.Drawing.Drawing2D.GraphicsPath -> unit
Public Sub FillPath (brush As Brush, path As GraphicsPath)

Parametri

brush
Brush

Oggetto Brush che determina le caratteristiche del riempimento.

path
GraphicsPath

Oggetto GraphicsPath che rappresenta il tracciato da riempire.

Eccezioni

brush è null.

-oppure-

path è null.

Esempio

L'esempio di codice seguente è progettato per l'uso con Windows Forms e richiede PaintEventArgse, che è un parametro del Paint gestore eventi. Il codice esegue le azioni seguenti:

  • Crea un pennello rosso a tinta unita.

  • Crea un oggetto percorso grafico.

  • Aggiunge un'ellisse al percorso grafico.

  • Riempie il percorso sullo schermo.

public:
   void FillPathEllipse( PaintEventArgs^ e )
   {
      // Create solid brush.
      SolidBrush^ redBrush = gcnew SolidBrush( Color::Red );

      // Create graphics path object and add ellipse.
      GraphicsPath^ graphPath = gcnew GraphicsPath;
      graphPath->AddEllipse( 0, 0, 200, 100 );

      // Fill graphics path to screen.
      e->Graphics->FillPath( redBrush, graphPath );
   }
public void FillPathEllipse(PaintEventArgs e)
{
             
    // Create solid brush.
    SolidBrush redBrush = new SolidBrush(Color.Red);
             
    // Create graphics path object and add ellipse.
    GraphicsPath graphPath = new GraphicsPath();
    graphPath.AddEllipse(0, 0, 200, 100);
             
    // Fill graphics path to screen.
    e.Graphics.FillPath(redBrush, graphPath);
}
Public Sub FillPathEllipse(ByVal e As PaintEventArgs)

    ' Create solid brush.
    Dim redBrush As New SolidBrush(Color.Red)

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

    ' Fill graphics path to screen.
    e.Graphics.FillPath(redBrush, graphPath)
End Sub

Commenti

Un GraphicsPath oggetto è costituito da una serie di segmenti di linea e curva. Se il percorso rappresentato dal path parametro non è chiuso, viene aggiunto un segmento aggiuntivo dall'ultimo punto al primo punto per chiudere il percorso.

Si applica a