Share via


Graphics.FillRectangle(const Brush*, const Rect) method

Applies to: desktop apps only

The Graphics::FillRectangle method uses a brush to fill the interior of a rectangle.

Syntax

Status FillRectangle(
  [in]       const Brush *brush,
  [in, ref]  const Rect &rect
);

Parameters

  • brush [in]
    Type: const Brush*

    Pointer to a Brush that is used to paint the interior of the rectangle.

  • rect [in, ref]
    Type: const Rect

    Reference to the rectangle to be filled.

Return value

Type:

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.

Examples

The following example fills a rectangle.

VOID Example_FillRectangle(HDC hdc)
{
   Graphics graphics(hdc);
   // Create a SolidBrush object.
   SolidBrush blackBrush(Color(255, 0, 0, 0));
   // Create a Rect object.
   Rect fillRect(0, 0, 100, 100);
   // Fill the rectangle.
   graphics.FillRectangle(&blackBrush, fillRect);
}

Requirements

Minimum supported client

Windows XP, Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Product

GDI+ 1.0

Header

Gdiplusgraphics.h (include Gdiplus.h)

Library

Gdiplus.lib

DLL

Gdiplus.dll

See also

Graphics

Color

Rect

Status

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012