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

Комментарии

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

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