SetTextColor

Syntax

DWORD SetTextColor(hDC,crColor)

This function sets the text color to the color specified by the crColor parameter, or to the nearest physical color if the device cannot represent the color specified by crColor. GDI uses the text color to draw the face of each character written by the TextOut and ExtText-Out functions. GDI also uses the text color when converting bitmaps from color to monochrome and vice versa.

The background color for a character is specified by the SetBkColor and SetBkMode functions. For color-bitmap conversions, see the BitBlt and StretchBlt functions, earlier in this chapter.

Parameter Type/Description  

hDC HDC Identifies the device context.  
crColor COLORREF Specifies the color of the text.  

Return Value

The return value specifies an RGB color value for the previous text color.