windows_programming_notes.nbk: Home | Index | Next Page: SetTimer | Previous Page: SetTextAlign


 SetTextColor

The SetTextColor function sets the text color for the specified device context to the specified color.

    COLORREF SetTextColor(
      HDC hdc,           // handle to DC
      COLORREF crColor   // text color
    );

Parameters

Return Values

If the function succeeds, the return value is a color reference for the previous text color as a COLORREF value.

If the function fails, the return value is CLR_INVALID.

Windows NT/2000 or later: To get extended error information, call GetLastError.

Remarks

The text color is used to draw the face of each character written by the TextOut and ExtTextOut functions. The text color is also used in converting bitmaps from color to monochrome and vice versa.

For an example, see Setting Fonts for Menu-Item Text Strings.

Requirements


windows_programming_notes.nbk: Home | Index | Next Page: SetTimer | Previous Page: SetTextAlign


Notebook exported on Monday, 7 July 2008, 18:56:50 PM Eastern Daylight Time