Graphics.FillPath(Brush, GraphicsPath) Metod

Definition

Fyller insidan av en 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)

Parametrar

brush
Brush

Brush som avgör fyllningens egenskaper.

path
GraphicsPath

GraphicsPath som representerar sökvägen som ska fyllas.

Undantag

brush är null.

-eller-

path är null.

Exempel

Följande kodexempel är utformat för användning med Windows Forms och kräver PaintEventArgse, vilket är en parameter för händelsehanteraren Paint. Koden utför följande åtgärder:

  • Skapar en helröd borste.

  • Skapar ett objekt för grafiksökväg.

  • Lägger till en ellips i grafiksökvägen.

  • Fyller sökvägen på skärmen.

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

Kommentarer

A GraphicsPath består av en serie linje- och kurvsegment. Om sökvägen som representeras av parametern path inte stängs läggs ytterligare ett segment till från den sista punkten till den första punkten för att stänga sökvägen.

Gäller för