Leggere in inglese

Condividi tramite


Graphics.FillRectangles Metodo

Definizione

Riempie gli interni di una serie di rettangoli specificati da Rectangle strutture.

Overload

FillRectangles(Brush, ReadOnlySpan<RectangleF>)
FillRectangles(Brush, ReadOnlySpan<Rectangle>)
FillRectangles(Brush, RectangleF[])

Riempie gli interni di una serie di rettangoli specificati da RectangleF strutture.

FillRectangles(Brush, Rectangle[])

Riempie gli interni di una serie di rettangoli specificati da Rectangle strutture.

FillRectangles(Brush, ReadOnlySpan<RectangleF>)

Origine:
Graphics.cs
Origine:
Graphics.cs
C#
public void FillRectangles (System.Drawing.Brush brush, scoped ReadOnlySpan<System.Drawing.RectangleF> rects);

Parametri

brush
Brush

Si applica a

.NET 9 e Windows Desktop 9
Prodotto Versioni
.NET 9
Windows Desktop 9

FillRectangles(Brush, ReadOnlySpan<Rectangle>)

Origine:
Graphics.cs
Origine:
Graphics.cs
C#
public void FillRectangles (System.Drawing.Brush brush, scoped ReadOnlySpan<System.Drawing.Rectangle> rects);

Parametri

brush
Brush

Si applica a

.NET 9 e Windows Desktop 9
Prodotto Versioni
.NET 9
Windows Desktop 9

FillRectangles(Brush, RectangleF[])

Origine:
Graphics.cs
Origine:
Graphics.cs
Origine:
Graphics.cs
Origine:
Graphics.cs
Origine:
Graphics.cs

Riempie gli interni di una serie di rettangoli specificati da RectangleF strutture.

C#
public void FillRectangles (System.Drawing.Brush brush, System.Drawing.RectangleF[] rects);
C#
public void FillRectangles (System.Drawing.Brush brush, params System.Drawing.RectangleF[] rects);

Parametri

brush
Brush

Brush che determina le caratteristiche del riempimento.

rects
RectangleF[]

Matrice di strutture RectangleF che rappresentano i rettangoli da riempire.

Eccezioni

brush è null.

-o-

rects è null.

Rects è una matrice di lunghezza zero.

Esempio

L'esempio di codice seguente è progettato per l'uso con Windows Form e richiede PaintEventArgse, che è un parametro del gestore eventi Paint. Il codice esegue l'azione seguente:

  • Crea un pennello blu a tinta unita.

  • Crea una matrice di tre rettangoli.

  • Riempie le tre aree rettangolari sullo schermo.

C#
private void FillRectanglesRectangleF(PaintEventArgs e)
{

    // Create solid brush.
    SolidBrush blueBrush = new SolidBrush(Color.Blue);

    // Create array of rectangles.
    RectangleF[] rects = { new RectangleF(0.0F, 0.0F, 100.0F, 200.0F), new RectangleF(100.0F, 200.0F, 250.0F, 50.0F), new RectangleF(300.0F, 0.0F, 50.0F, 100.0F) };

    // Fill rectangles to screen.
    e.Graphics.FillRectangles(blueBrush, rects);
}

Si applica a

.NET 9 e altre versioni
Prodotto Versioni
.NET 6, 7, 8, 9
.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
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

FillRectangles(Brush, Rectangle[])

Origine:
Graphics.cs
Origine:
Graphics.cs
Origine:
Graphics.cs
Origine:
Graphics.cs
Origine:
Graphics.cs

Riempie gli interni di una serie di rettangoli specificati da Rectangle strutture.

C#
public void FillRectangles (System.Drawing.Brush brush, System.Drawing.Rectangle[] rects);
C#
public void FillRectangles (System.Drawing.Brush brush, params System.Drawing.Rectangle[] rects);

Parametri

brush
Brush

Brush che determina le caratteristiche del riempimento.

rects
Rectangle[]

Matrice di strutture Rectangle che rappresentano i rettangoli da riempire.

Eccezioni

brush è null.

-o-

rects è null.

rects è una matrice di lunghezza zero.

Esempio

L'esempio di codice seguente è progettato per l'uso con Windows Form e richiede PaintEventArgse, che è un parametro del gestore eventi Paint. Il codice esegue l'azione seguente:

  • Crea un pennello blu a tinta unita.

  • Crea una matrice di tre rettangoli.

  • Riempie le tre aree rettangolari sullo schermo.

C#
private void FillRectanglesRectangle(PaintEventArgs e)
{

    // Create solid brush.
    SolidBrush blueBrush = new SolidBrush(Color.Blue);

    // Create array of rectangles.
    Rectangle[] rects = { new Rectangle(0, 0, 100, 200), new Rectangle(100, 200, 250, 50), new Rectangle(300, 0, 50, 100) };

    // Fill rectangles to screen.
    e.Graphics.FillRectangles(blueBrush, rects);
}

Si applica a

.NET 9 e altre versioni
Prodotto Versioni
.NET 6, 7, 8, 9
.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
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9