4

The Delphi XE2 skinning option is fantastic, but there are cases where you want to inform Delphi to leave an element or form alone. In my case I have a splash form that was created completely inside Delphi - and this is ruined because the skin overrides all colors implicitly.

Is there some way I can inform Delphi or the skinning-engine that it should leave a control or form alone?

Jon Lennart Aasenden
  • 3,920
  • 2
  • 29
  • 44
  • 6
    Check this question [How to disable VCL styles in Delphi](http://stackoverflow.com/questions/8598728/how-to-disable-vcl-styles-in-delphi) – RRUZ Feb 04 '12 at 18:48

1 Answers1

3

I would try to use something like this (was not tested)

TStyleManager.Engine.RegisterStyleHook(TYourSplashForm, TStyleHook);
Martin Reiner
  • 2,167
  • 2
  • 20
  • 34
  • Almost worked. It fixed the problem with the form's background color. But the TPanel objects and label objects which makes up the form remain skinned. I have turned off parentcolor and parentbackground - but it didnt have an effect :( – Jon Lennart Aasenden Feb 04 '12 at 17:56
  • I also tried to change the color and font-color in a timer, just to get a delay between showing the form and applying color -- but no effect. The styles override everything. – Jon Lennart Aasenden Feb 04 '12 at 17:58
  • Then try to do the same also for `TPanel` and `TLabel`. `TStyleManager.Engine.RegisterStyleHook(TPanel, TStyleHook);` and `TStyleManager.Engine.RegisterStyleHook(TLabel, TStyleHook);` but I can't verify now if it doesn't affect the styles in the whole application. – Martin Reiner Feb 04 '12 at 18:00
  • I havent used this before, but the above code would register the entire class (TPanel) and would thus screw up the forms that should be skinned (if they have TPanel instances on them -- right?). I was afraid of this, that I have to create my own custom classes to bypass the skinning engine :/ – Jon Lennart Aasenden Feb 04 '12 at 18:08
  • So then try to call `TStyleManager.Engine.UnRegisterStyleHook(TPanel, TStyleHook);` and `TStyleManager.Engine.UnRegisterStyleHook(TLabel, TStyleHook);` after you hide the splash screen and before you open the application form. – Martin Reiner Feb 04 '12 at 18:41
  • Line @RRus mentiones above, my question had been asked before (http://stackoverflow.com/questions/8598728/how-to-disable-vcl-styles-in-delphi). The solution seem to be (testing now) to redeclare any classes you have used on that form. So if i use a TButton, then i have to declate TButton again. Thanks both, hope this works. – Jon Lennart Aasenden Feb 04 '12 at 19:27