Freigeben über


Graphics.FillPath-Methode

Füllt das Innere eines GraphicsPath.

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

Syntax

'Declaration
Public Sub FillPath ( _
    brush As Brush, _
    path As GraphicsPath _
)
'Usage
Dim instance As Graphics
Dim brush As Brush
Dim path As GraphicsPath

instance.FillPath(brush, path)
public void FillPath (
    Brush brush,
    GraphicsPath path
)
public:
void FillPath (
    Brush^ brush, 
    GraphicsPath^ path
)
public void FillPath (
    Brush brush, 
    GraphicsPath path
)
public function FillPath (
    brush : Brush, 
    path : GraphicsPath
)

Parameter

  • brush
    Brush, der die Merkmale des Füllvorgangs bestimmt.

Ausnahmen

Ausnahmetyp Bedingung

ArgumentNullException

pen ist NULL (Nothing in Visual Basic).

- oder -

path ist NULL (Nothing in Visual Basic).

Hinweise

Ein GraphicsPath besteht aus einer Reihe von Linien- und Kurvensegmenten. Wenn der durch den path-Parameter dargestellte Pfad nicht geschlossen ist, wird zwischen dem letzten und dem ersten Punkt ein zusätzliches Segment eingefügt, das den Pfad schließt.

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 einen einfarbigen roten Pinsel.

  • Erstellt ein Grafikpfadobjekt.

  • Fügt dem Grafikpfad eine Ellipse hinzu.

  • Füllt den Pfad auf dem Bildschirm aus.

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
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:
   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.get_Red());

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

    // Fill graphics path to screen.
    e.get_Graphics().FillPath(redBrush, graphPath);
} //FillPathEllipse

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