Graphics::DrawRectangles(constPen*,constRectF*,INT) method (gdiplusgraphics.h)

The Graphics::DrawRectangles method draws a sequence of rectangles.

Syntax

Status DrawRectangles(
  const Pen   *pen,
  const RectF *rects,
  INT         count
);

Parameters

pen

Pointer to a Pen that is used to draw the rectangles.

rects

Pointer to an array of RectF objects that specify the coordinates of the rectangles to be drawn.

count

Integer that specifies the number of elements in the rects array.

Return value

If the method succeeds, it returns Ok, which is an element of the Status enumeration.

If the method fails, it returns one of the other elements of the Status enumeration.

Remarks

Examples

The following example draws a group of rectangles.

VOID Example_DrawRectangles2(HDC hdc)
{
   Graphics graphics(hdc);

   // Create a Pen object.
   Pen blackPen(Color(255, 0, 0, 0), 3);
   
   // Create an array of RectF objects.
   RectF rect1(0.0f, 0.0f, 100.0f, 200.0f);
   RectF rect2(100.0f, 200.0f, 250.0f, 50.0f);
   RectF rect3(300.0f, 0.0f, 50.0f, 100.0f);
   RectF rects[] = {rect1, rect2, rect3};
   RectF* pRects = rects;

   // Draw the rectangles.
   graphics.DrawRectangles(&blackPen, pRects, 3);
}

Requirements

Requirement Value
Header gdiplusgraphics.h

See also

DrawRectangles Methods

FillRectangle Methods

Graphics

Pens, Lines, and Rectangles

Rect

Using a Pen to Draw Lines and Rectangles