HPALETTE SelectPalette(hDC,hPalette,bForceBackground)
This function selects the logical palette specified by the hPalette parameter as the selected palette object of the device context identified by the hDC parameter. The new palette becomes the palette object used by GDI to control colors displayed in the device context and replaces the previous palette.
Parameter | Type/Description |
hDC | HDC Identifies the device context. | |
hPalette | HPALETTE Identifies the logical palette to be selected. CreatePalette creates a logical palette. | |
bForceBackground | BOOL 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 input focus. If bForceBackground is zero, the logical palette is a foreground palette when the window has input focus. |
The return value identifies the logical palette being replaced by the palette specified by the hPalette parameter. It is NULL if there is an error.
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 object into more than one device context, the device contexts must all belong to the same physical device (such as a display or printer).