Partager via


CDC::SelectPalette

Selects the logical palette that is specified by pPalette as the selected palette object of the device context.

CPalette* SelectPalette(
   CPalette* pPalette,
   BOOL bForceBackground 
);

Parameters

  • pPalette
    Identifies the logical palette to be selected. This palette must already have been created with the CPalette member function CreatePalette.

  • bForceBackground
    Specifies whether the logical palette is forced to be a background palette. If bForceBackground is nonzero, the selected palette is always a background palette, regardless of whether the window has the input focus. If bForceBackground is 0 and the device context is attached to a window, the logical palette is a foreground palette when the window has the input focus.

Return Value

A pointer to a CPalette object identifying the logical palette replaced by the palette specified by pPalette. It is NULL if there is an error.

Remarks

The new palette becomes the palette object used by GDI to control colors displayed in the device context and replaces the previous palette.

An application can select a logical palette into more than one device context. However, changes to a logical palette will affect all device contexts for which it is selected. If an application selects a palette into more than one device context, the device contexts must all belong to the same physical device.

Requirements

Header: afxwin.h

See Also

Reference

CDC Class

Hierarchy Chart

CDC::RealizePalette

CPalette Class

SelectPalette

Other Resources

CDC Members