Graphics.FillPath(Brush, GraphicsPath) Método
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Preenche o interior de um 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)
Parâmetros
- path
- GraphicsPath
GraphicsPath Isso representa o caminho a preencher.
Exceções
Exemplos
O seguinte exemplo de código foi concebido para uso com Windows Forms e requer PaintEventArgse, que é um parâmetro do tratador de eventos Paint. O código executa as seguintes ações:
Cria um pincel vermelho sólido.
Cria um objeto de caminho gráfico.
Adiciona uma elipse ao percurso gráfico.
Preenche o caminho no ecrã.
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
Observações
A GraphicsPath consiste numa série de segmentos de linha e curva. Se o caminho representado pelo path parâmetro não estiver fechado, adiciona-se um segmento adicional do último ponto ao primeiro ponto para fechar o caminho.