Mega Code Archive

 
Categories / Delphi / Graphic
 

Getting the right color from e.g. the scrollbar

Title: Getting the right color from e.g. the scrollbar Question: The Color property can have a value like clBtnFace, but if you want to get the RGB-values of this color the results don`t correspond the real RGB-values Answer: This colors (clBtnFace, ...) represents indices in the windows system colortable and therefore you have to get the right values out of this colortable for the matching index. To get the real TColor of this colors (for example clBtnFace) you can use this function function GetTColor (AColor : TColor) : TColor; begin if AColor AColor := GetSysColor (Color and $FF) else AColor := Color; end;