void FillRect( LPCRECT lpRect, CBrush* pBrush );
Parameters
lpRect
Points to a RECT structure that contains the logical coordinates of the rectangle to be filled. You can also pass a CRect object for this parameter.
pBrush
Identifies the brush used to fill the rectangle.
Remarks
Call this member function to fill a given rectangle using the specified brush. The function fills the complete rectangle, including the left and top borders, but it does not fill the right and bottom borders.
The brush needs to either be created using the CBrush member functions CreateHatchBrush, CreatePatternBrush, and CreateSolidBrush, or retrieved by the ::GetStockObject Windows function.
When filling the specified rectangle, FillRect 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 members 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.
FillRect is similar to CDC::FillSolidRect; however, FillRect takes a brush and therefore can be used to fill a rectangle with a solid color, a dithered color, hatched brushes, or a pattern. FillSolidRect uses only solid colors (indicated by a COLORREF parameter). FillRect usually is slower than FillSolidRect.
CDC Overview | Class Members | Hierarchy Chart
See Also CBrush::CreateHatchBrush, CBrush::CreatePatternBrush, CBrush::CreateSolidBrush, ::FillRect, ::GetStockObject, RECT, CBrush, CDC::FillSolidRect