Freigeben über


Graphics.FillRectangle(const Brush*, INT, INT, INT, INT) 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]  INT x,
  [in]  INT y,
  [in]  INT width,
  [in]  INT height
);

Parameters

  • brush [in]
    Type: const Brush*

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

  • x [in]
    Type: INT

    Integer that specifies the x-coordinate of the upper-left corner of the rectangle to be filled.

  • y [in]
    Type: INT

    Integer that specifies the y-coordinate of the upper-left corner of the rectangle to be filled.

  • width [in]
    Type: INT

    Integer that specifies the width of the rectangle to be filled.

  • height [in]
    Type: INT

    Integer that specifies the height of 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 defines a rectangle and then fills it.

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

   // Create a SolidBrush object.
   SolidBrush blackBrush(Color(255, 0, 0, 0));

   // Define the rectangle.
   int x = 0;
   int y = 0;
   int width = 100;
   int height = 100;

   // Fill the rectangle.
   graphics.FillRectangle(&blackBrush, x, y, width, height);
}

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