Since XE2, there are several themes that can be used for your application. E.g. Carbon that changes the background color of the TListView to gray besides other things.
Is there any way to get this color?
TListView.Color returns white altough the background is some kind of gray.
I tried using StyleServices.GetElementDetails with a snippet like this:
var lColor: TColor;
lDetails: TThemedElementDetails;
if StyleServices.Enabled then
begin
lDetails := StyleServices.GetElementDetails(tlListviewRoot);
StyleServices.GetElementColor(lDetails, ecFillColor, lColor);
end;
But GetElementColor
fails and returns false. Am I using the wrong parameter? Or is my approach just wrong.
The possible parameters can be found here:
TThemedListView
TElementColor
Thank you.
P.S.: I also read this post but the answer didn't help me so far.
To get the background color of the TListView that has a StyleHook implemented :
uses Vcl.Themes;
var Color : TColor;
Color := StyleServices.GetStyleColor(scListView);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With