Title: Finding the window caption gradient end color
Question: Delphi has TColor constants declared to get the default window caption colors (clActiveCaption, clInactiveCaption). How do I find the end color when there is a a gradient effect in the caption bar?
Answer:
const
clActiveCaptionGradient: TColor = clActiveCaption;
clInactiveCaptionGradient: TColor = clInactiveCaption;
procedure GetCaptionGradientColors;
var
UseGradient: boolean;
begin
// Check first if there is a gradient effect
if (SystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, @UseGradient, 0)) then
if (UseGradient) then begin
clActiveCaptionGradient := GetSysColor(COLOR_GRADIENTACTIVECAPTION);
clInactiveCaptionGradient := GetSysColor(COLOR_GRADIENTINACTIVECAPTION);
end;
end;