Graphics.FillPath(Brush, GraphicsPath) Метод

Определение

Заполняет интерьер объекта 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)

Параметры

brush
Brush

Brush определяет характеристики заливки.

path
GraphicsPath

GraphicsPath значение, представляющее путь для заполнения.

Исключения

brush равно null.

–или–

path равно null.

Примеры

Следующий пример кода предназначен для использования с Windows Forms и требуется PaintEventArgse />, который является параметром обработчика событий Paint. Код выполняет следующие действия:

  • Создает сплошную красную кисть.

  • Создает объект графического пути.

  • Добавляет многоточие в графический путь.

  • Заполняет путь на экране.

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

Комментарии

A GraphicsPath состоит из ряда сегментов линии и кривой. Если путь, представленный path параметром, не закрыт, дополнительный сегмент добавляется из последней точки в первую точку, чтобы закрыть путь.

Применяется к