GraphicsPath::AddRectangle(constRectF&) method (gdipluspath.h)

The GraphicsPath::AddRectangle method adds a rectangle to this path.

Syntax

Status AddRectangle(
  const RectF & rect
);

Parameters

rect

Reference to a rectangle to be added to the path.

Return value

Type: Status

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 creates a GraphicsPath object path, adds a rectangle to path, and then draws path.

VOID Example_AddRectangle(HDC hdc)
{
   Graphics graphics(hdc);
   RectF rect(20.0f, 20.0f, 100.0f, 50.0f);

   GraphicsPath path;
   path.AddRectangle(rect);

   // Draw the path.
   Pen pen(Color(255, 255, 0, 0));
   graphics.DrawPath(&pen, &path);
}

Requirements

Requirement Value
Header gdipluspath.h

See also

AddPolygon Methods

Clipping with a Region

Constructing and Drawing Paths

Creating a Path Gradient

GraphicsPath

Paths

PointF

Polygons