int FillRect(hDC,lpRect,hBrush)
This 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.
Parameter | Type/Description |
hDC | HDC Identifies the device context. | |
lpRect | LPRECT Points to a RECT data structure that contains the logical coordinates of the rectangle to be filled. | |
hBrush | HBRUSH Identifies the brush used to fill the rectangle. |
Although the FillRect function return type is an integer, the return value is not used and has no meaning.
The brush must have been created previously by using either the CreateHatchBrush, CreatePatternBrush, or CreateSolidBrush function, or retrieved using the GetStock-Object function.
When filling the specified rectangle, the FillRect function does not include the rectangle's right and bottom sides. GDI fills a rectangle up to, but does not include, the right column and bottom row, regardless of the current mapping mode.
FillRect compares the values of the top, bottom, left, and right fields of the specified rectangle. If bottom is less than or equal to top, or if right is less than or equal to left, the rectangle is not drawn.