FillRect

2.x

  int FillRect(hdc, lprc, hbr)    
  HDC hdc; /* handle of device context */
  const RECT FAR* lprc; /* address of structure with rectangle */
  HBRUSH hbr; /* handle of brush, */  

The FillRect function fills a given rectangle by using the specified brush. The FillRect function fills the complete rectangle, including the left and top borders, but does not fill the right and bottom borders.

Parameters

hdc

Identifies the device context.

lprc

Points to a RECT structure that contains the logical coordinates of the rectangle to be filled. The RECT structure has the following form:

typedef struct tagRECT {    /* rc */
   int left;
   int top;
   int right;
   int bottom;
} RECT;

For a full description of this structure, see the Microsoft Windows Programmer's Reference, Volume 3.

hbr

Identifies the brush used to fill the rectangle.

Return Value

The return value is not used and has no meaning.

Comments

The brush must be created by using either the CreateHatchBrush, CreatePatternBrush, or CreateSolidBrush function, or retrieved by using the GetStockObject function.

When filling the specified rectangle, the FillRect function does not include the rectangle's right and bottom sides. Graphics device interface (GDI) fills a rectangle up to, but not including, the right column and bottom row, regardless of the current mapping mode.

FillRect compares the values of the top, bottom, left, and right members of the specified RECT structure. If bottom is less than or equal to top, or if right is less than or equal to left, the function does not draw the rectangle.

See Also

CreateHatchBrush, CreatePatternBrush, CreateSolidBrush, GetStockObject, InvertRect