Graphics.FillRectangle Método
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Rellena el interior de un rectángulo especificado por un par de coordenadas, un ancho y un alto.
FillRectangle(Brush, Rectangle) |
Rellena el interior de un rectángulo especificado por una estructura Rectangle. |
FillRectangle(Brush, RectangleF) |
Rellena el interior de un rectángulo especificado por una estructura RectangleF. |
FillRectangle(Brush, Int32, Int32, Int32, Int32) |
Rellena el interior de un rectángulo especificado por un par de coordenadas, un ancho y un alto. |
FillRectangle(Brush, Single, Single, Single, Single) |
Rellena el interior de un rectángulo especificado por un par de coordenadas, un ancho y un alto. |
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
Rellena el interior de un rectángulo especificado por una estructura Rectangle.
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
Excepciones
brush
es null
.
Ejemplos
El ejemplo de código siguiente está diseñado para su uso con Windows Forms y requiere PaintEventArgse
, que es un parámetro del controlador de eventos Paint. El código realiza la siguiente acción:
Crea un pincel azul sólido.
Crea un rectángulo.
Rellena el área rectangular en la pantalla.
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
Comentarios
Este método rellena el interior del rectángulo definido por el parámetro rect
, incluida la esquina superior izquierda especificada y hasta los bordes inferiores e inferiores calculados.
Se aplica a
.NET 10 (package-provided) y otras versiones
Producto | Versiones |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided) |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
Rellena el interior de un rectángulo especificado por una estructura RectangleF.
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 estructura que representa el rectángulo que se va a rellenar.
Excepciones
brush
es null
.
Ejemplos
El ejemplo de código siguiente está diseñado para su uso con Windows Forms y requiere PaintEventArgse
, que es un parámetro del controlador de eventos Paint. El código realiza la siguiente acción:
Crea un pincel azul sólido.
Crea un rectángulo.
Rellena el área rectangular en la pantalla.
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
Comentarios
Este método rellena el interior del rectángulo definido por el parámetro rect
, incluida la esquina superior izquierda especificada y hasta los bordes inferiores e inferiores calculados.
Se aplica a
.NET 10 (package-provided) y otras versiones
Producto | Versiones |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided) |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
Rellena el interior de un rectángulo especificado por un par de coordenadas, un ancho y un alto.
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
Coordenada x de la esquina superior izquierda del rectángulo que se va a rellenar.
- y
- Int32
Coordenada y de la esquina superior izquierda del rectángulo que se va a rellenar.
- width
- Int32
Ancho del rectángulo que se va a rellenar.
- height
- Int32
Alto del rectángulo que se va a rellenar.
Excepciones
brush
es null
.
Ejemplos
El ejemplo de código siguiente está diseñado para su uso con Windows Forms y requiere PaintEventArgse
, que es un parámetro del controlador de eventos Paint. El código realiza la siguiente acción:
Crea un pincel azul sólido.
Crea la ubicación y el tamaño de un rectángulo.
Rellena el área rectangular en la pantalla.
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
Comentarios
Este método rellena el interior del rectángulo definido por elx
, y
, width
y height
parámetros, incluida la esquina superior izquierda especificada y hasta los bordes inferiores e inferiores calculados.
Se aplica a
.NET 10 (package-provided) y otras versiones
Producto | Versiones |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided) |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
Rellena el interior de un rectángulo especificado por un par de coordenadas, un ancho y un alto.
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
Coordenada x de la esquina superior izquierda del rectángulo que se va a rellenar.
- y
- Single
Coordenada y de la esquina superior izquierda del rectángulo que se va a rellenar.
- width
- Single
Ancho del rectángulo que se va a rellenar.
- height
- Single
Alto del rectángulo que se va a rellenar.
Excepciones
brush
es null
.
Ejemplos
El ejemplo de código siguiente está diseñado para su uso con Windows Forms y requiere PaintEventArgse
, que es un parámetro del controlador de eventos Paint. El código realiza la siguiente acción:
Crea un pincel azul sólido.
Crea la ubicación y el tamaño de un rectángulo.
Rellena el área rectangular en la pantalla.
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
Comentarios
Este método rellena el interior del rectángulo definido por el x
, y
, width
y height
parámetros, incluida la esquina superior izquierda especificada y hasta los bordes inferiores e inferiores calculados.
Se aplica a
.NET 10 (package-provided) y otras versiones
Producto | Versiones |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided) |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |
Comentarios de .NET
.NET es un proyecto de código abierto. Seleccione un vínculo para proporcionar comentarios: