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.
It turns out that among other bugs, sometimes the TForm.StyleBook property does not automatically get assigned. If you make sure it is assigned, then the above steps work.
Quick steps:
- Create form.
- Drop style book on form, and assign Form.StyleBook = StyleBook1
- Right click on control you wish to modify style on, click Edit Custom Style.
- Go to object inspector and modify Fill property to change background color of panel, for instance.
- Apply and close. (May have to click two, three or four times due to window focus bugs)
Note: This workaround is not useful in Delphi XE4 and up as the feature "Custom style setting" was removed from Mobile application FMX.
Best Answer
No, for the moment there is no such thing like a gallery of styles for FireMonkey or VCL styles. But if you want to create you own try these entries in my blog which show an easy way to create/modify new VCL styles and FireMoney styles in few clicks. Both articles include additional styles to download.