Muokkaa

Jaa


GraphicsPath.AddRectangles Method

Definition

Adds a series of rectangles to this path.

Overloads

AddRectangles(Rectangle[])

Adds a series of rectangles to this path.

AddRectangles(RectangleF[])

Adds a series of rectangles to this path.

AddRectangles(ReadOnlySpan<Rectangle>)

Adds a series of rectangles to this path.

AddRectangles(ReadOnlySpan<RectangleF>)

Adds a series of rectangles to this path.

AddRectangles(Rectangle[])

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs

Adds a series of rectangles to this path.

public:
 void AddRectangles(... cli::array <System::Drawing::Rectangle> ^ rects);
public:
 void AddRectangles(cli::array <System::Drawing::Rectangle> ^ rects);
public void AddRectangles (params System.Drawing.Rectangle[] rects);
public void AddRectangles (System.Drawing.Rectangle[] rects);
member this.AddRectangles : System.Drawing.Rectangle[] -> unit
Public Sub AddRectangles (ParamArray rects As Rectangle())
Public Sub AddRectangles (rects As Rectangle())

Parameters

rects
Rectangle[]

An array of Rectangle structures that represents the rectangles to add.

Examples

The following code example is designed for use with Windows Forms, and it requires PaintEventArgs e, an OnPaint event object. The code performs the following actions:

  • Creates a path.

  • Creates an array of rectangles and adds the rectangles to the path.

  • Draws the path to the screen.

private:
   void AddRectanglesExample( PaintEventArgs^ e )
   {
      // Adds a pattern of rectangles to a GraphicsPath object.
      GraphicsPath^ myPath = gcnew GraphicsPath;
      array<Rectangle>^ pathRects = {Rectangle(20,20,100,200),Rectangle(40,40,120,220),Rectangle(60,60,240,140)};
      myPath->AddRectangles( pathRects );

      // Draw the path to the screen.
      Pen^ myPen = gcnew Pen( Color::Black,2.0f );
      e->Graphics->DrawPath( myPen, myPath );
   }
private void AddRectanglesExample(PaintEventArgs e)
{
             
    // Adds a pattern of rectangles to a GraphicsPath object.
    GraphicsPath myPath = new GraphicsPath();
    Rectangle[] pathRects =
             {
                 new Rectangle(20,20,100,200),
                 new Rectangle(40,40,120,220),
                 new Rectangle(60,60,240,140)
             };
    myPath.AddRectangles(pathRects);
             
    // Draw the path to the screen.
    Pen myPen = new Pen(Color.Black, 2);
    e.Graphics.DrawPath(myPen, myPath);
}
Public Sub AddRectanglesExample(ByVal e As PaintEventArgs)

    ' Adds a pattern of rectangles to a GraphicsPath object.
    Dim myPath As New GraphicsPath
    Dim pathRects As Rectangle() = {New Rectangle(20, 20, 100, 200), _
    New Rectangle(40, 40, 120, 220), New Rectangle(60, 60, 240, 140)}
    myPath.AddRectangles(pathRects)

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

Applies to

AddRectangles(RectangleF[])

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs

Adds a series of rectangles to this path.

public:
 void AddRectangles(... cli::array <System::Drawing::RectangleF> ^ rects);
public:
 void AddRectangles(cli::array <System::Drawing::RectangleF> ^ rects);
public void AddRectangles (params System.Drawing.RectangleF[] rects);
public void AddRectangles (System.Drawing.RectangleF[] rects);
member this.AddRectangles : System.Drawing.RectangleF[] -> unit
Public Sub AddRectangles (ParamArray rects As RectangleF())
Public Sub AddRectangles (rects As RectangleF())

Parameters

rects
RectangleF[]

An array of RectangleF structures that represents the rectangles to add.

Examples

For an example, see AddRectangles(Rectangle[]).

Applies to

AddRectangles(ReadOnlySpan<Rectangle>)

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs

Adds a series of rectangles to this path.

public:
 void AddRectangles(ReadOnlySpan<System::Drawing::Rectangle> rects);
public void AddRectangles (scoped ReadOnlySpan<System.Drawing.Rectangle> rects);
member this.AddRectangles : ReadOnlySpan<System.Drawing.Rectangle> -> unit
Public Sub AddRectangles (rects As ReadOnlySpan(Of Rectangle))

Parameters

rects
ReadOnlySpan<Rectangle>

An array of RectangleF structures that represents the rectangles to add.

Applies to

AddRectangles(ReadOnlySpan<RectangleF>)

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs

Adds a series of rectangles to this path.

public:
 void AddRectangles(ReadOnlySpan<System::Drawing::RectangleF> rects);
public void AddRectangles (scoped ReadOnlySpan<System.Drawing.RectangleF> rects);
member this.AddRectangles : ReadOnlySpan<System.Drawing.RectangleF> -> unit
Public Sub AddRectangles (rects As ReadOnlySpan(Of RectangleF))

Parameters

rects
ReadOnlySpan<RectangleF>

An array of RectangleF structures that represents the rectangles to add.

Applies to