GraphicsPath.AddRectangle Methode

Definitie

Hiermee voegt u een rechthoek toe aan dit pad.

Overloads

Name Description
AddRectangle(RectangleF)

Hiermee voegt u een rechthoek toe aan dit pad.

AddRectangle(Rectangle)

Hiermee voegt u een rechthoek toe aan dit pad.

AddRectangle(RectangleF)

Bron:
GraphicsPath.cs
Bron:
GraphicsPath.cs
Bron:
GraphicsPath.cs
Bron:
GraphicsPath.cs
Bron:
GraphicsPath.cs
Bron:
GraphicsPath.cs
Bron:
GraphicsPath.cs
Bron:
GraphicsPath.cs

Hiermee voegt u een rechthoek toe aan dit pad.

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)

Parameters

rect
RectangleF

Een RectangleF die de rechthoek vertegenwoordigt die moet worden toegevoegd.

Voorbeelden

Zie AddRectangle(Rectangle)voor een voorbeeld.

Van toepassing op

AddRectangle(Rectangle)

Bron:
GraphicsPath.cs
Bron:
GraphicsPath.cs
Bron:
GraphicsPath.cs
Bron:
GraphicsPath.cs
Bron:
GraphicsPath.cs
Bron:
GraphicsPath.cs
Bron:
GraphicsPath.cs
Bron:
GraphicsPath.cs

Hiermee voegt u een rechthoek toe aan dit pad.

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)

Parameters

rect
Rectangle

Een Rectangle die de rechthoek vertegenwoordigt die moet worden toegevoegd.

Voorbeelden

Het volgende codevoorbeeld is ontworpen voor gebruik met Windows Forms en vereist PaintEventArgse, een OnPaint-gebeurtenisobject. De code voert de volgende acties uit:

  • Hiermee maakt u een pad.

  • Hiermee maakt u een rechthoek en voegt u de rechthoek toe aan het pad.

  • Hiermee tekent u het pad naar het scherm.

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

Van toepassing op