GraphicsPath.AddRectangle Methode

Definition

Fügt diesem Pfad ein Rechteck hinzu.

Überlädt

AddRectangle(RectangleF)

Fügt diesem Pfad ein Rechteck hinzu.

AddRectangle(Rectangle)

Fügt diesem Pfad ein Rechteck hinzu.

AddRectangle(RectangleF)

Quelle:
GraphicsPath.cs
Quelle:
GraphicsPath.cs
Quelle:
GraphicsPath.cs

Fügt diesem Pfad ein Rechteck hinzu.

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)

Parameter

rect
RectangleF

Ein RectangleF, das das hinzuzufügende Rechteck darstellt.

Beispiele

Ein Beispiel finden Sie unter AddRectangle(Rectangle).

Gilt für:

AddRectangle(Rectangle)

Quelle:
GraphicsPath.cs
Quelle:
GraphicsPath.cs
Quelle:
GraphicsPath.cs

Fügt diesem Pfad ein Rechteck hinzu.

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)

Parameter

rect
Rectangle

Ein Rectangle, das das hinzuzufügende Rechteck darstellt.

Beispiele

Das folgende Codebeispiel ist für die Verwendung mit Windows Forms konzipiert und erfordert PaintEventArgseein OnPaint Ereignisobjekt. Der Code führt die folgenden Aktionen aus:

  • Erstellt einen Pfad.

  • Erstellt ein Rechteck und fügt das Rechteck dem Pfad hinzu.

  • Zeichnet den Pfad zum Bildschirm.

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

Gilt für: