Collapse the table of content
Expand the table of content



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

      CPalette* SelectPalette(
   CPalette* pPalette,
   BOOL bForceBackground 


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


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.

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.

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.


Header: afxwin.h

© 2016 Microsoft