The Windows palette management is very complicated. Every Windows ApplicationProgramThey all have their own color palette. When using the color palette, you must first apply for it by the system. Windows assigns the palette Based on the Application priority. Applications with the highest priority can obtain the foreground color palette of windows. Other programs use the background color palette.
To ensure the consistency of Windows Basic Display Interfaces, Windows retains the internal system color palette of 20 colors, which is used to draw window icons and boundaries through the interface. This palette will not change in all display settings.
Each device context has a logical palette. To use a color other than the internal system palette, you should create a new logical palette and select it into the device context. In this way, new colors cannot be used. Only the logical color palette in the device context can be implemented in the system color palette. When the logical palette is implemented to the system palette, Windows creates a palette ing table. When drawing with a logical palette, the GDI Plotting Program directly queries the palette ing table to convert the pixel value from the index of the logical palette to the index of the system palette.