Graphics.FillRectangle Graphics.FillRectangle Graphics.FillRectangle Method

Definizione

Riempie l'area interna di un rettangolo specificato da una coppia di coordinate, una larghezza e un'altezza.Fills the interior of a rectangle specified by a pair of coordinates, a width, and a height.

Overload

FillRectangle(Brush, Rectangle) FillRectangle(Brush, Rectangle) FillRectangle(Brush, Rectangle)

Riempie l'area interna di un rettangolo specificato da una struttura Rectangle.Fills the interior of a rectangle specified by a Rectangle structure.

FillRectangle(Brush, RectangleF) FillRectangle(Brush, RectangleF) FillRectangle(Brush, RectangleF)

Riempie l'area interna di un rettangolo specificato da una struttura RectangleF.Fills the interior of a rectangle specified by a RectangleF structure.

FillRectangle(Brush, Int32, Int32, Int32, Int32) FillRectangle(Brush, Int32, Int32, Int32, Int32) FillRectangle(Brush, Int32, Int32, Int32, Int32)

Riempie l'area interna di un rettangolo specificato da una coppia di coordinate, una larghezza e un'altezza.Fills the interior of a rectangle specified by a pair of coordinates, a width, and a height.

FillRectangle(Brush, Single, Single, Single, Single) FillRectangle(Brush, Single, Single, Single, Single) FillRectangle(Brush, Single, Single, Single, Single)

Riempie l'area interna di un rettangolo specificato da una coppia di coordinate, una larghezza e un'altezza.Fills the interior of a rectangle specified by a pair of coordinates, a width, and a height.

FillRectangle(Brush, Rectangle) FillRectangle(Brush, Rectangle) FillRectangle(Brush, Rectangle)

Riempie l'area interna di un rettangolo specificato da una struttura Rectangle.Fills the interior of a rectangle specified by a Rectangle structure.

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

Parametri

brush
Brush Brush Brush

Oggetto Brush che determina le caratteristiche del riempimento.Brush that determines the characteristics of the fill.

rect
Rectangle Rectangle Rectangle

Struttura Rectangle che rappresenta il rettangolo da riempire.Rectangle structure that represents the rectangle to fill.

Eccezioni

Esempi

L'esempio di codice seguente è progettato per l'uso con Windows Forms e richiede PaintEventArgs e, che Paint è un parametro del gestore eventi.The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. Il codice esegue l'azione seguente:The code performs the following action:

  • Crea un pennello blu a tinta unita.Creates a solid blue brush.

  • Crea un rettangolo.Creates a rectangle.

  • Riempie l'area rettangolare sullo schermo.Fills the rectangular area on the screen.

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

Commenti

Questo metodo riempie l'area interna del rettangolo definito dal rect parametro, incluso l'angolo superiore sinistro specificato e fino al bordo inferiore e inferiore calcolato.This method fills the interior of the rectangle defined by the rect parameter, including the specified upper-left corner and up to the calculated lower and bottom edges.

FillRectangle(Brush, RectangleF) FillRectangle(Brush, RectangleF) FillRectangle(Brush, RectangleF)

Riempie l'area interna di un rettangolo specificato da una struttura RectangleF.Fills the interior of a rectangle specified by a RectangleF structure.

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

Parametri

brush
Brush Brush Brush

Oggetto Brush che determina le caratteristiche del riempimento.Brush that determines the characteristics of the fill.

rect
RectangleF RectangleF RectangleF

Struttura RectangleF che rappresenta il rettangolo da riempire.RectangleF structure that represents the rectangle to fill.

Eccezioni

Esempi

L'esempio di codice seguente è progettato per l'uso con Windows Forms e richiede PaintEventArgs e, che Paint è un parametro del gestore eventi.The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. Il codice esegue l'azione seguente:The code performs the following action:

  • Crea un pennello blu a tinta unita.Creates a solid blue brush.

  • Crea un rettangolo.Creates a rectangle.

  • Riempie l'area rettangolare sullo schermo.Fills the rectangular area on the screen.

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

Commenti

Questo metodo riempie l'area interna del rettangolo definito dal rect parametro, incluso l'angolo superiore sinistro specificato e fino al bordo inferiore e inferiore calcolato.This method fills the interior of the rectangle defined by the rect parameter, including the specified upper-left corner and up to the calculated lower and bottom edges.

FillRectangle(Brush, Int32, Int32, Int32, Int32) FillRectangle(Brush, Int32, Int32, Int32, Int32) FillRectangle(Brush, Int32, Int32, Int32, Int32)

Riempie l'area interna di un rettangolo specificato da una coppia di coordinate, una larghezza e un'altezza.Fills the interior of a rectangle specified by a pair of coordinates, a width, and a height.

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

Parametri

brush
Brush Brush Brush

Oggetto Brush che determina le caratteristiche del riempimento.Brush that determines the characteristics of the fill.

x
Int32 Int32 Int32

Coordinata x dell'angolo superiore sinistro del rettangolo da riempire.The x-coordinate of the upper-left corner of the rectangle to fill.

y
Int32 Int32 Int32

Coordinata y dell'angolo superiore sinistro del rettangolo da riempire.The y-coordinate of the upper-left corner of the rectangle to fill.

width
Int32 Int32 Int32

Larghezza del rettangolo da riempire.Width of the rectangle to fill.

height
Int32 Int32 Int32

Altezza del rettangolo da riempire.Height of the rectangle to fill.

Eccezioni

Esempi

L'esempio di codice seguente è progettato per l'uso con Windows Forms e richiede PaintEventArgs e, che Paint è un parametro del gestore eventi.The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. Il codice esegue l'azione seguente:The code performs the following action:

  • Crea un pennello blu a tinta unita.Creates a solid blue brush.

  • Crea la posizione e le dimensioni di un rettangolo.Creates the location and size of a rectangle.

  • Riempie l'area rettangolare sullo schermo.Fills the rectangular area on the screen.

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

Commenti

xQuesto metodo riempie l'area interna del rettangolo definito dai parametri, y, widthe height , incluso l'angolo superiore sinistro specificato e fino al bordo inferiore e inferiore calcolato.This method fills the interior of the rectangle defined by thex, y, width, and height parameters, including the specified upper-left corner and up to the calculated lower and bottom edges.

FillRectangle(Brush, Single, Single, Single, Single) FillRectangle(Brush, Single, Single, Single, Single) FillRectangle(Brush, Single, Single, Single, Single)

Riempie l'area interna di un rettangolo specificato da una coppia di coordinate, una larghezza e un'altezza.Fills the interior of a rectangle specified by a pair of coordinates, a width, and a height.

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

Parametri

brush
Brush Brush Brush

Oggetto Brush che determina le caratteristiche del riempimento.Brush that determines the characteristics of the fill.

x
Single Single Single

Coordinata x dell'angolo superiore sinistro del rettangolo da riempire.The x-coordinate of the upper-left corner of the rectangle to fill.

y
Single Single Single

Coordinata y dell'angolo superiore sinistro del rettangolo da riempire.The y-coordinate of the upper-left corner of the rectangle to fill.

width
Single Single Single

Larghezza del rettangolo da riempire.Width of the rectangle to fill.

height
Single Single Single

Altezza del rettangolo da riempire.Height of the rectangle to fill.

Eccezioni

Esempi

L'esempio di codice seguente è progettato per l'uso con Windows Forms e richiede PaintEventArgs e, che Paint è un parametro del gestore eventi.The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. Il codice esegue l'azione seguente:The code performs the following action:

  • Crea un pennello blu a tinta unita.Creates a solid blue brush.

  • Crea la posizione e le dimensioni di un rettangolo.Creates the location and size of a rectangle.

  • Riempie l'area rettangolare sullo schermo.Fills the rectangular area on the screen.

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

Commenti

xQuesto metodo riempie l'area interna del rettangolo definito dai parametri, y, widthe height , incluso l'angolo superiore sinistro specificato e fino al bordo inferiore e inferiore calcolato.This method fills the interior of the rectangle defined by the x, y, width, and height parameters, including the specified upper-left corner and up to the calculated lower and bottom edges.

Si applica a