SetBkColor

Syntax

DWORD SetBkColor(hDC,crColor)

This function sets the current background color to the color specified by the crColor parameter, or to the nearest physical color if the device cannot represent an RGB color value specified by crColor.

If the background mode is OPAQUE, GDI uses the background color to fill the gaps between styled lines, gaps between hatched lines in brushes, and character cells. GDI also uses the background color when converting bitmaps from color to monochrome and vice versa.

The background mode is set by the SetBkMode function. See the BitBlt and StretchBlt functions, in this chapter, for color-bitmap conversions.

Parameter Type/Description  

hDC HDC Identifies the device context.  
crColor COLORREF Specifies the new background color.  

Return Value

The return value specifies the previous background color as an RGB color value. If an error occurs, the return value is 0x80000000.