Disable a style in VCL application

Posted by Martin on Stack Overflow See other posts from Stack Overflow or by Martin
Published on 2012-11-13T03:50:03Z Indexed on 2012/11/13 5:00 UTC
Read the original article Hit count: 283

Filed under:
|

I am adding the a VCL style into my application but am also giving the users an option to turn this off but I cannot figure out how to do this globally at runtime.

Setting "TStyleManager.AutoDiscoverStyleResources := false" almost works but it pops up with an error message saying "Style {style set} not found" but after dismissing the message does exactly what I want.

This code I would expect to work but does not...

if (not ParamObj.UseDarkStyle) then
begin
  //TStyleManager.AutoDiscoverStyleResources := false;
  TStyleManager.SetStyle(TStyleManager.SystemStyle);
end;

I also tried (originally)

TStyleManager.TrySetStyle('Windows');

but this also does not work.

I have tried this both sides of "Application.Initialize;" with no difference

What am I missing? Thanks in advance, Martin

© Stack Overflow or respective owner

Related posts about delphi

Related posts about vcl-styles