Site icon Embarcadero RAD Studio, Delphi, & C++Builder Blogs

Adding a custom style selector to your VCL application

the future of starts demands massive productivity

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:Users\Public\Documents\Embarcadero\Studio\19.0\Styles 

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!’]

Exit mobile version