Responds to changes in the system's palette by realizing the control's palette.
function PaletteChanged(Foreground: Boolean): Boolean; dynamic;
__fastcall Boolean PaletteChanged(Boolean Foreground);
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.
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!