Adding a custom style selector to your VCL application

by May 12, 2017

Adding a style selector menu to your application only takes a couple of lines of code and allows you to quickly update your existing user interface while providing added flexibility to your customers.

To add a style selector, I added a combobox to the form with the following code:

uses VCL.Themes;

procedure TForm9.StyleSelectorChange(Sender: TObject);
begin
  TStyleManager.SetStyle(StyleSelector.Text);
end;

procedure TForm9.FormCreate(Sender: TObject);
var
  StyleName: string;
begin
  for StyleName in TStyleManager.StyleNames do
    StyleSelector.Items.Add(StyleName);
  StyleSelector.ItemIndex := StyleSelector.Items.IndexOf(TStyleManager.ActiveStyle.Name);
end;
end.

 
The combo box will display the styles you've selected via Project > Options > Application > Appearance.

 

In this post, I am highlighting some of our Windows 10 styles that are included in 10.2 Tokyo, along with custom styles from DelphiStyles.com

To use custom styles, you will need to move the .vsf files into the following folder:

C:UsersPublicDocumentsEmbarcaderoStudio19.0Styles 

Shown: Windows 10 Green VCL style, included in 10.2 Tokyo

 

Shown: Windows 10 Slate Gray VCL style, included in 10.2 Tokyo

 

Shown: Madison Dark VCL style, available at DelphiStyles.com

 

Shown: Oxford Blue VCL style, available at DelphiStyles.com

 

Shown: Material White VCL style, available at DelphiStyles.com

 

[DownloadButton Product=’Delphi’ Caption=’Download a RAD Studio 10.2 Trial Today!’]