Graphics.FillPath(Brush, GraphicsPath) Methode

Definition

Füllt das Innere von einem GraphicsPath aus.

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)

Parameter

brush
Brush

Brush, der die Merkmale des Füllvorgangs bestimmt.

path
GraphicsPath

GraphicsPath, der den auszufüllenden Pfad darstellt.

Ausnahmen

brush ist null.

- oder -

path ist null.

Beispiele

Das folgende Codebeispiel ist für die Verwendung mit Windows Forms konzipiert und erfordert PaintEventArgse, was ein Parameter des Paint Ereignishandlers ist. Der Code führt die folgenden Aktionen aus:

  • Erstellt einen durchgehenden roten Pinsel.

  • Erstellt ein Grafikpfadobjekt.

  • Fügt dem Grafikpfad eine Ellipse hinzu.

  • Füllt den Pfad auf dem Bildschirm aus.

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

Hinweise

Ein GraphicsPath besteht aus einer Reihe von Linien- und Kurvensegmenten. Wenn der durch den path -Parameter dargestellte Pfad nicht geschlossen wird, wird ein zusätzliches Segment vom letzten Punkt bis zum ersten Punkt hinzugefügt, um den Pfad zu schließen.

Gilt für: