MFC (Microsoft Foundation Classes) provides the FillSolidRect function to fill a specified rectangle with a solid color.

The syntax for using the FillSolidRect function is as follows:

void FillSolidRect(
   LPCRECT lpRect,
   COLORREF clr
);

Parameters:

  • lpRect: A pointer to a RECT structure that specifies the rectangle to be filled.
  • clr: The RGB color value (COLORREF) to use for filling the rectangle.

Example usage:

CRect rect(100, 100, 200, 200); // Create a rectangle with coordinates (100, 100) to (200, 200)
COLORREF color = RGB(255, 0, 0); // Create a red color
pDC->FillSolidRect(&rect, color); // Fill the rectangle with the specified color

In the above example, pDC is a CDC (device context) object on which the FillSolidRect function is called to fill the rectangle with the specified color. The rectangle is defined by CRect structure with coordinates (100, 100) to (200, 200), and the color is specified as red using the RGB macro.


原文地址: https://www.cveoy.top/t/topic/jgev 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录