3 out of 4 rated this helpful - Rate this topic

SetTextColor function

Applies to: desktop apps only

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

Syntax

COLORREF SetTextColor(
  __in  HDC hdc,
  __in  COLORREF crColor
);

Parameters

hdc [in]

A handle to the device context.

crColor [in]

The color of the text.

Return value

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.

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.

Examples

For an example, see "Setting Fonts for Menu-Item Text Strings" in Using Menus.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Wingdi.h (include Windows.h)

Library

Gdi32.lib

DLL

Gdi32.dll

See also

Fonts and Text Overview
Font and Text Functions
BitBlt
ExtTextOut
GetTextColor
RGB
SetBkColor
StretchBlt
TextOut
COLORREF

 

 

Send comments about this topic to Microsoft

Build date: 3/7/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ