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

Aggiunge un rettangolo a questo percorso.

public:
 void AddRectangle(System::Drawing::RectangleF rect);
public void AddRectangle (System.Drawing.RectangleF rect);
member this.AddRectangle : System.Drawing.RectangleF -> unit
Public Sub AddRectangle (rect As RectangleF)

Parametri

rect
RectangleF

Struttura RectangleF che rappresenta il rettangolo da aggiungere.

Esempio

Per un esempio, vedere AddRectangle(Rectangle).

Si applica a

AddRectangle(Rectangle)

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

Aggiunge un rettangolo a questo percorso.

public:
 void AddRectangle(System::Drawing::Rectangle rect);
public void AddRectangle (System.Drawing.Rectangle rect);
member this.AddRectangle : System.Drawing.Rectangle -> unit
Public Sub AddRectangle (rect As Rectangle)

Parametri

rect
Rectangle

Struttura Rectangle che rappresenta il rettangolo da aggiungere.

Esempio

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

  • Crea un percorso.

  • Crea un rettangolo e aggiunge il rettangolo al percorso.

  • Disegna il percorso dello schermo.

private:
   void AddRectangleExample( PaintEventArgs^ e )
   {
      // Create a GraphicsPath object and add a rectangle to it.
      GraphicsPath^ myPath = gcnew GraphicsPath;
      Rectangle pathRect = Rectangle(20,20,100,200);
      myPath->AddRectangle( pathRect );

      // Draw the path to the screen.
      Pen^ myPen = gcnew Pen( Color::Black,2.0f );
      e->Graphics->DrawPath( myPen, myPath );
   }
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);
}
Public Sub AddRectangleExample(ByVal e As PaintEventArgs)

    ' Create a GraphicsPath object and add a rectangle to it.
    Dim myPath As New GraphicsPath
    Dim pathRect As New Rectangle(20, 20, 100, 200)
    myPath.AddRectangle(pathRect)

    ' Draw the path to the screen.
    Dim myPen As New Pen(Color.Black, 2)
    e.Graphics.DrawPath(myPen, myPath)
End Sub

Si applica a