Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the Forms background color with VCL.Styles

Some components paint their color with the Color property setting even when vcl,styles are used. So when using a Metro dark style (nearly black) and a components color is set to clWindow the components color does not match the style. Is there a way to get the forms background color when using a vcl.style so that the color property of a component can be set to match the forms styled background color?

The color can be obtained by loading the style in the style designer, but I'd like to get the color value at runtime.

like image 930
Bill Avatar asked Aug 26 '13 21:08

Bill


2 Answers

You can use the GetSystemColor function passing the proper system color constant to get

for example to get the background color of a TEdit component use

TStyleManager.ActiveStyle.GetSystemColor(clWindow)

And to get the default background color of a form try

TStyleManager.ActiveStyle.GetSystemColor(clBtnFace)
like image 106
RRUZ Avatar answered Sep 22 '22 18:09

RRUZ


Also you can use :

StyleServices.GetStyleColor(scWindow)
like image 37
S.MAHDI Avatar answered Sep 24 '22 18:09

S.MAHDI