How to disable VCL styles in Delphi

tedgebrowser
delphi managed records

I am using the new VCL styles system in Delphi XE2. It works great, but I wish to disable it for a particular form that has a number of images on it (a splash/about form). Problem is I can't seem to find a property of the form that associates it with a particular style, and so can't disable it for that form only. There only seems to be the global TStyleManager class which appears to be static.

With this in mind, is the only way to achieve this to call TStyleManager.TrySetStyle('Windows'), show the form, and then set it back to the original style when the form is closed?

The VCL Styles apply a skin to all of the VCL application, but you can disable the VCL Styles for a particular control class. So if you want disable the VCL Styles for a particular form, you can use the RegisterStyleHook function passing the type of the form and the TStyleHook class which is a empty style hook class.

This line of code will disable the VCL Styles in all the forms of the type TFormChild:

TStyleManager.Engine.RegisterStyleHook(TFormChild, TStyleHook);

Now, if you run this code all controls of the form, TFormChild will still painted with the VCL Styles, so to fix that you must disable the default Style hook for all the controls of the form using a trick like this

unit uChild;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;

type
  TButton   = class(Vcl.StdCtrls.TButton); //This declaration is only for disabling the TButton of this form
  TFormChild = class(TForm)
    Button1: TButton;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

and now you can disable the VCL Styles of the TButton of this form as well with this code

TStyleManager.Engine.RegisterStyleHook(uChild.TButton, TStyleHook);

If you want more information about the use of the TStyleHook Class, check the article Exploring Delphi XE2 – VCL Styles Part II.

Disabling the VCL Styles in the non client area of a Form, Delphi XE2 VCL styles, How to disable VCL styles on TBitBtn? I am using the new VCL styles system in Delphi XE2 and its work fine but on one� The VCL Styles apply a skin to all of the VCL application, but you can disable the VCL Styles for a particular control class. So if you want disable the VCL Styles for a particular form, you can use the RegisterStyleHook function passing the type of the form and the TStyleHook class which is a empty style hook class.

Removing (uncheck) the seClient option from the StyleElements property of the Splash Form did the trick for me (Delphi XE10).

Delphi XE2 VCL styles, How to disable VCL styles on , In 10.4 the VCL library allows you to use multiple VCL styles at the same time in You can set StyleName as 'Windows' to disable applying any style for time and get to market faster with RAD Studio, Delphi, or C++Builder. I am using the new VCL styles system in Delphi XE2. It works great, but I wish to disable it for a particular form that has a number of images on it (a splash/about form). Problem is I can't seem to find a property of the form that associates it with a particular style, and so can't disable it for that form only.

The easiest way is to put the splash-form in a seperate DLL. That way the styler won't touch it.

VCL Per-Control Styles - New in RAD Studio 10.4, StyleElements Property. Delphi XE3 introduces the possibility of flexible tuning of styles to different elements of VCL controls: font colors, client parts, borders, and � Today I receive a question about how disable the vcl styles in the non client area of a vcl form. Well that can be done using a Style hook. Tipically a VCL form with a vcl style look like this To remove the vcl style in the non client are we need create a style…

Tuning VCL Styles for Forms and Controls, I am using the new VCL styles system in Delphi XE2 and its work fine but on one Form I want exception. This Form contains number of TBitBtn control and each� Web resources about - Is there a way to disable (Turn Off) Delphi VCL Styles at runtime? - embarcadero.delphi.non-tech Android Runtime - Wikipedia, the free encyclopedia Android Runtime ( ART ) is an application runtime environment used by the Android mobile operating system .

Delphi XE2 VCL styles, How to disable VCL styles on TBitBtn?, Built thought controlled drone with Google Glass; Host of Podcast at Delphi.org; Lives near Boise, Idaho, USA Additional styles in the VCL premium style pack. The VCL Styles apply a skin to all of the VCL application, but you can disable the VCL Styles for a particular control class. So if you want disable the VCL Styles for a particular form, you can use the RegisterStyleHook function passing the type of the form and the TStyleHook class which is a empty style hook class.

Cool Tricks for VCL Styles - Google Slides, Delphi XE2 VCL styles, How to disable VCL styles on TBitBtn? TBitBtn = class( Vcl.Buttons.TBitBtn) private procedure MyDrawItem(const DrawItemStruct:� VCL Styles. Intended for use with RAD Studio XE3 - 10.4 Sydney (Delphi and C++ Builder) Product includes ready to use VCL Style

Comments
  • AFAICT, with the new Styles it's all or nothing. IOW, if you use Styles, they apply to every single form in your app, and there's no way to selectively enable/disable them on a per-form basis.
  • Just an additional Note : the above answer only covers the controls inherited of the TWinControl class, also some controls will require which you create a custom a TStyle Hook class to ignore the current style.
  • I knew you'd have a solution for this issue, Rodrigo :) That's why I posted a comment instead of an answer. Nice work - +1.
  • @AlanClark You had me searching for what an 'Interpolator' is, until I realized you meant an Interceptor class... At least that is how I know the concept and have heard it talked about :)
  • @Marjan - Yet it was originally coined up as an "interposer class" in May 1998 issue of the delphi magazine. I guess it is time that we abbreviate it as an IC, shorthand for "intersomething class". <g>
  • @Sertac: Thanks for the history. Didn't know that. Abbreviating it sounds good to me :)
  • Hardly easy. Then you also have to check if the DLL exists, if the proc's line up, and also add extra work to the installer. Surely its easier to add X number of sourcelines and be done with it :)
  • Why downvote? Seem totally reasonable to me if that solves the problem!
  • Probably the down-votes are because of the "The easiest way" phrase. This is valid answer but definitively not the 'easy way'.