COLORREF类对象的构造
参考自: [1]: https://docs.microsoft.com/en-us/cpp/mfc/reference/cdc-class?view=vs-2019#settextcolor
参照 CDC::Draw3dRect 成员函数中COLORREF类对象的构造:
两个重载的CDC::Draw3dRect 成员函数:
void Draw3dRect(
LPCRECT lpRect,
COLORREF clrTopLeft,
COLORREF clrBottomRight);
void Draw3dRect(
int x,
int y,
int cx,
int cy,
COLORREF clrTopLeft,
COLORREF clrBottomRight);
参数:
lpRect
Specifies the bounding rectangle (in logical units). You can pass either a pointer to a RECT structure or a CRect object for this parameter.
clrTopLeft
Specifies the color of the top and left sides of the three-dimensional rectangle.
clrBottomRight
Specifies the color of the bottom and right sides of the three-dimensional rectangle.
x
Specifies the logical x-coordinate of the upper-left corner of the three-dimensional rectangle.
y
Specifies the logical y-coordinate of the upper-left corner of the three-dimensional rectangle.
cx
Specifies the width of the three-dimensional rectangle.
cy
Specifies the height of the three-dimensional rectangle.
Remarks
The rectangle will be drawn with the top and left sides in the color specified by clrTopLeft and the bottom and right sides in the color specified by clrBottomRight.
参考示例:
void CDCView::Draw3dRect(CDC* pDC)
{
// get the client area
CRect rect;
GetClientRect(rect);
// shrink our rect 20 pixels on all sides
rect.DeflateRect(20, 20);
// draw a rectangle with red top and left sides, and
// green right and bottom sides.
pDC->Draw3dRect(rect, RGB(255, 0, 0), RGB(0, 255, 0));
// This call to the four-integer override would draw
// the same rectangle with a little less convenience:
// pDC->Draw3dRect(rect.left, rect.top, rect.Width(), rect.Height(),
// RGB(255, 0, 0), RGB(0, 255, 0));
}