GraphicsPath.AddRectangle Metodo

Definizione

Aggiunge un rettangolo a questo percorso.

Overload

AddRectangle(RectangleF)

Aggiunge un rettangolo a questo percorso.

AddRectangle(Rectangle)

Aggiunge un rettangolo a questo percorso.

AddRectangle(RectangleF)

Origine:
GraphicsPath.cs
Origine:
GraphicsPath.cs
Origine:
GraphicsPath.cs
Origine:
GraphicsPath.cs
Origine:
GraphicsPath.cs

Aggiunge un rettangolo a questo percorso.

C#
public void AddRectangle (System.Drawing.RectangleF rect);

Parametri

rect
RectangleF

Oggetto RectangleF che rappresenta il rettangolo da aggiungere.

Esempio

Per un esempio, vedere AddRectangle(Rectangle).

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

AddRectangle(Rectangle)

Origine:
GraphicsPath.cs
Origine:
GraphicsPath.cs
Origine:
GraphicsPath.cs
Origine:
GraphicsPath.cs
Origine:
GraphicsPath.cs

Aggiunge un rettangolo a questo percorso.

C#
public void AddRectangle (System.Drawing.Rectangle rect);

Parametri

rect
Rectangle

Oggetto Rectangle che rappresenta il rettangolo da aggiungere.

Esempio

L'esempio di codice seguente è progettato per l'uso con Windows Form e richiede PaintEventArgse, un oggetto evento OnPaint. Il codice esegue le azioni seguenti:

  • Crea un percorso.

  • Crea un rettangolo e aggiunge il rettangolo al percorso.

  • Disegna il percorso dello schermo.

C#
private void AddRectangleExample(PaintEventArgs e)
{
             
    // Create a GraphicsPath object and add a rectangle to it.
    GraphicsPath myPath = new GraphicsPath();
    Rectangle pathRect = new Rectangle(20, 20, 100, 200);
    myPath.AddRectangle(pathRect);
             
    // Draw the path to the screen.
    Pen myPen = new Pen(Color.Black, 2);
    e.Graphics.DrawPath(myPen, myPath);
}

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