VC中的SetTextColor函数

来源:百度知道 编辑:UC知道 时间:2024/05/13 04:27:18
SetTextColor 函数的参数是什么 举个例行吗 谢了

COLORREF SetTextColor(
HDC hdc,
COLORREF crColor
);
Parameters
hdc
[in] Handle to the device context.
crColor
[in] Value of type COLORREF that specifies the color of the text.
Return Values
A color reference for the previous text color indicates success. CLR_INVALID indicates failure. To get extended error information, call GetLastError.
以上内容摘自msdn.翻译如下:
函数原型:
COLORREF SetTextColor(
HDC hdc,
COLORREF crColor
);
参数:

hdc:
[输入]设备上下文句柄。
crColor
[输入] 声明要使用的文本颜色值,取值范围参见COLORREF
返回值:
返回颜色值说明调用成功,返回CLR_INVALID,说明调用失败,要得到出错信息,调用GetLastError()函数。

举个例子,
HDC dc;
dc.getDC();
SetTextColor(dc,0x00ffffff); //将字的颜色设为黑色。

你查MSDN啊?

dc->SetTextColor(RGB(255, 0, 0));
dc->SetTextColor(0x0000ff);