GetBkMode

2.x

  int GetBkMode(hdc)    
  HDC hdc; /* handle of device context */

The GetBkMode function returns the background mode. The background mode defines whether the system removes existing background colors on the drawing surface before drawing text, hatched brushes, or any pen style that is not a solid line.

Parameters

hdc

Identifies the device context.

Return Value

The return value specifies the current background mode if the function is successful. It can be OPAQUE, TRANSPARENT, or TRANSPARENT1.

Example

The following example determines the current background mode by calling the GetBkMode function. If the mode is OPAQUE, the SetBkMode function sets it to TRANSPARENT.

int nBackMode;

nBackMode = GetBkMode(hdc);
if (nBackMode == OPAQUE) {
    TextOut(hdc, 90, 100, "This background mode is OPAQUE.", 31);
    SetBkMode(hdc, TRANSPARENT);
}

See Also

GetBkColor, SetBkColor, SetBkMode