共用方式為


CDC::SetBkColor

Sets the current background color to the specified color.

virtual COLORREF SetBkColor(
   COLORREF crColor 
);

Parameters

  • crColor
    Specifies the new background color.

Return Value

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

Remarks

If the background mode is OPAQUE, the system uses the background color to fill the gaps in styled lines, the gaps between hatched lines in brushes, and the background in character cells. The system also uses the background color when converting bitmaps between color and monochrome device contexts.

If the device cannot display the specified color, the system sets the background color to the nearest physical color.

Requirements

Header: afxwin.h

See Also

Reference

CDC Class

Hierarchy Chart

CDC::BitBlt

CDC::GetBkColor

CDC::GetBkMode

CDC::SetBkMode

CDC::StretchBlt

SetBkColor

Other Resources

CDC Members