Graphics.FillRectangle 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 retângulo especificado por um par de coordenadas, uma largura e uma altura.
Sobrecargas
| Name | Description |
|---|---|
| FillRectangle(Brush, Rectangle) |
Preenche o interior de um retângulo especificado por uma Rectangle estrutura. |
| FillRectangle(Brush, RectangleF) |
Preenche o interior de um retângulo especificado por uma RectangleF estrutura. |
| FillRectangle(Brush, Int32, Int32, Int32, Int32) |
Preenche o interior de um retângulo especificado por um par de coordenadas, uma largura e uma altura. |
| FillRectangle(Brush, Single, Single, Single, Single) |
Preenche o interior de um retângulo especificado por um par de coordenadas, uma largura e uma altura. |
FillRectangle(Brush, Rectangle)
Preenche o interior de um retângulo especificado por uma Rectangle estrutura.
public:
void FillRectangle(System::Drawing::Brush ^ brush, System::Drawing::Rectangle rect);
public void FillRectangle(System.Drawing.Brush brush, System.Drawing.Rectangle rect);
member this.FillRectangle : System.Drawing.Brush * System.Drawing.Rectangle -> unit
Public Sub FillRectangle (brush As Brush, rect As Rectangle)
Parâmetros
Exceções
brush é null.
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 a seguinte ação:
Cria um pincel azul sólido.
Cria um retângulo.
Preenche a área retangular no ecrã.
public:
void FillRectangleRectangle( PaintEventArgs^ e )
{
// Create solid brush.
SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue );
// Create rectangle.
Rectangle rect = Rectangle(0,0,200,200);
// Fill rectangle to screen.
e->Graphics->FillRectangle( blueBrush, rect );
}
private void FillRectangleRectangle(PaintEventArgs e)
{
// Create solid brush.
SolidBrush blueBrush = new SolidBrush(Color.Blue);
// Create rectangle.
Rectangle rect = new Rectangle(0, 0, 200, 200);
// Fill rectangle to screen.
e.Graphics.FillRectangle(blueBrush, rect);
}
Private Sub FillRectangleRectangle(ByVal e As PaintEventArgs)
' Create solid brush.
Dim blueBrush As New SolidBrush(Color.Blue)
' Create rectangle.
Dim rect As New Rectangle(0, 0, 200, 200)
' Fill rectangle to screen.
e.Graphics.FillRectangle(blueBrush, rect)
End Sub
Observações
Este método preenche o interior do retângulo definido pelo rect parâmetro, incluindo o canto superior esquerdo especificado e até às arestas inferior e inferior calculadas.
Aplica-se a
FillRectangle(Brush, RectangleF)
Preenche o interior de um retângulo especificado por uma RectangleF estrutura.
public:
void FillRectangle(System::Drawing::Brush ^ brush, System::Drawing::RectangleF rect);
public void FillRectangle(System.Drawing.Brush brush, System.Drawing.RectangleF rect);
member this.FillRectangle : System.Drawing.Brush * System.Drawing.RectangleF -> unit
Public Sub FillRectangle (brush As Brush, rect As RectangleF)
Parâmetros
- rect
- RectangleF
RectangleF que representa o retângulo a preencher.
Exceções
brush é null.
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 a seguinte ação:
Cria um pincel azul sólido.
Cria um retângulo.
Preenche a área retangular no ecrã.
public:
void FillRectangleRectangleF( PaintEventArgs^ e )
{
// Create solid brush.
SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue );
// Create rectangle.
RectangleF rect = RectangleF(0.0F,0.0F,200.0F,200.0F);
// Fill rectangle to screen.
e->Graphics->FillRectangle( blueBrush, rect );
}
private void FillRectangleRectangleF(PaintEventArgs e)
{
// Create solid brush.
SolidBrush blueBrush = new SolidBrush(Color.Blue);
// Create rectangle.
RectangleF rect = new RectangleF(0.0F, 0.0F, 200.0F, 200.0F);
// Fill rectangle to screen.
e.Graphics.FillRectangle(blueBrush, rect);
}
Private Sub FillRectangleRectangleF(ByVal e As PaintEventArgs)
' Create solid brush.
Dim blueBrush As New SolidBrush(Color.Blue)
' Create rectangle.
Dim rect As New RectangleF(0.0F, 0.0F, 200.0F, 200.0F)
' Fill rectangle to screen.
e.Graphics.FillRectangle(blueBrush, rect)
End Sub
Observações
Este método preenche o interior do retângulo definido pelo rect parâmetro, incluindo o canto superior esquerdo especificado e até às arestas inferior e inferior calculadas.
Aplica-se a
FillRectangle(Brush, Int32, Int32, Int32, Int32)
Preenche o interior de um retângulo especificado por um par de coordenadas, uma largura e uma altura.
public:
void FillRectangle(System::Drawing::Brush ^ brush, int x, int y, int width, int height);
public void FillRectangle(System.Drawing.Brush brush, int x, int y, int width, int height);
member this.FillRectangle : System.Drawing.Brush * int * int * int * int -> unit
Public Sub FillRectangle (brush As Brush, x As Integer, y As Integer, width As Integer, height As Integer)
Parâmetros
- x
- Int32
A coordenada x do canto superior esquerdo do retângulo para preencher.
- y
- Int32
A coordenada y do canto superior esquerdo do retângulo para preencher.
- width
- Int32
Largura do retângulo para preencher.
- height
- Int32
Altura do retângulo a preencher.
Exceções
brush é null.
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 a seguinte ação:
Cria um pincel azul sólido.
Cria a localização e o tamanho de um retângulo.
Preenche a área retangular no ecrã.
public:
void FillRectangleInt( PaintEventArgs^ e )
{
// Create solid brush.
SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue );
// Create location and size of rectangle.
int x = 0;
int y = 0;
int width = 200;
int height = 200;
// Fill rectangle to screen.
e->Graphics->FillRectangle( blueBrush, x, y, width, height );
}
private void FillRectangleInt(PaintEventArgs e)
{
// Create solid brush.
SolidBrush blueBrush = new SolidBrush(Color.Blue);
// Create location and size of rectangle.
int x = 0;
int y = 0;
int width = 200;
int height = 200;
// Fill rectangle to screen.
e.Graphics.FillRectangle(blueBrush, x, y, width, height);
}
Private Sub FillRectangleInt(ByVal e As PaintEventArgs)
' Create solid brush.
Dim blueBrush As New SolidBrush(Color.Blue)
' Create location and size of rectangle.
Dim x As Integer = 0
Dim y As Integer = 0
Dim width As Integer = 200
Dim height As Integer = 200
' Fill rectangle to screen.
e.Graphics.FillRectangle(blueBrush, x, y, width, height)
End Sub
Observações
Este método preenche o interior do retângulo definido pelosx parâmetros, y, width, e height incluindo o canto superior esquerdo especificado e até às arestas inferior e inferior calculadas.
Aplica-se a
FillRectangle(Brush, Single, Single, Single, Single)
Preenche o interior de um retângulo especificado por um par de coordenadas, uma largura e uma altura.
public:
void FillRectangle(System::Drawing::Brush ^ brush, float x, float y, float width, float height);
public void FillRectangle(System.Drawing.Brush brush, float x, float y, float width, float height);
member this.FillRectangle : System.Drawing.Brush * single * single * single * single -> unit
Public Sub FillRectangle (brush As Brush, x As Single, y As Single, width As Single, height As Single)
Parâmetros
- x
- Single
A coordenada x do canto superior esquerdo do retângulo para preencher.
- y
- Single
A coordenada y do canto superior esquerdo do retângulo para preencher.
- width
- Single
Largura do retângulo para preencher.
- height
- Single
Altura do retângulo a preencher.
Exceções
brush é null.
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 a seguinte ação:
Cria um pincel azul sólido.
Cria a localização e o tamanho de um retângulo.
Preenche a área retangular no ecrã.
public:
void FillRectangleFloat( PaintEventArgs^ e )
{
// Create solid brush.
SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue );
// Create location and size of rectangle.
float x = 0.0F;
float y = 0.0F;
float width = 200.0F;
float height = 200.0F;
// Fill rectangle to screen.
e->Graphics->FillRectangle( blueBrush, x, y, width, height );
}
private void FillRectangleFloat(PaintEventArgs e)
{
// Create solid brush.
SolidBrush blueBrush = new SolidBrush(Color.Blue);
// Create location and size of rectangle.
float x = 0.0F;
float y = 0.0F;
float width = 200.0F;
float height = 200.0F;
// Fill rectangle to screen.
e.Graphics.FillRectangle(blueBrush, x, y, width, height);
}
Private Sub FillRectangleFloat(ByVal e As PaintEventArgs)
' Create solid brush.
Dim blueBrush As New SolidBrush(Color.Blue)
' Create location and size of rectangle.
Dim x As Single = 0.0F
Dim y As Single = 0.0F
Dim width As Single = 200.0F
Dim height As Single = 200.0F
' Fill rectangle to screen.
e.Graphics.FillRectangle(blueBrush, x, y, width, height)
End Sub
Observações
Este método preenche o interior do retângulo definido pelos xparâmetros , y, width, e height incluindo o canto superior esquerdo especificado e até às arestas inferior e inferior calculadas.