function PaletteChanged(Foreground: Boolean): Boolean; dynamic;
DYNAMIC bool __fastcall PaletteChanged(bool Foreground);
Responds to changes in the system's palette by realizing the control's palette.
Override PaletteChanged to change how the control responds to Windows notifications that the system palette is changing. TControl responds to these notifications by trying to realize the control's palette, if any, into the current device context. If the change in the system palette causes the actual value of the control's palette to change, PaletteChanged invalidates the control so that it can repaint with the new palette.
Windows paints the active window with a foreground palette, while other windows are forced to use background palettes. Background palettes are approximate matches to the colors specified by the control's logical palette, given the limitations imposed by implementing the foreground palette. Windows only allows a single foreground palette.
PaletteChanged allows the control to obtain a new realization of its palette when the system palette changes. When Foreground is true, the form has been activated and the control is specifying the new foreground palette. When Foreground is false, another application or form has changed the foreground palette, and controls that are sensitive to the available palette should realize new background palettes to best match their logical palettes.
If the control does not have a logical palette to be realized into the current device context, GetPalette returns a handle of 0, and PaletteChanged returns false, indicating that no palette was realized. If GetPalette returns the handle to a logical palette, PaletteChanged realizes this palette into the current device context, and returns true.
Note: PaletteChanged is called only when the run-time video mode requires palette support, such as for 256 color mode, but not 16 million color mode.