SetBkColor

  COLORREF SetBkColor(hdc, crColor)    
  HDC hdc;    
  COLORREF crColor;    

The SetBkColor function sets the current background color to that specified by the crColor parameter, or to the nearest physical color if the device cannot represent the color value specified by crColor.

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

Parameters

hdc

Identifies the device context.

crColor

Specifies the new background color.

Return Value

The return value specifies the previous background color as a COLORREF value. If an error occurs, the return value is CLR_INVALID.

Comments

This function fills the gaps between styled lines that were drawn with a pen which was created by calling the CreatePen function; it does not fill the gaps between styled lines that were drawn with a pen which was created by calling the ExtCreatePen function.

See Also

CreatePen, SetBkMode, BitBlt, StretchBlt