RAD Studio 10.4.1 is now available! Learn more. Looking for discounts? Visit our Special Offers page!

How to load custom styles at runtime

During my session at CodeRage, I briefly talked about how to load custom styles at runtime. I wanted to elaborate on this topic and provide some detailed steps.

In this example, we are creating a mobile app for iOS and Android that uses the ‘Jet’ Premium StyleI added both styles via the resources dialog in the IDE and used the TStyleManager.LoadFromResource method to load either style at runtime.

When loading custom styles at runtime using the steps below, you don’t see the style at design time.

The first step is to add both styles to resources via ‘Project->Resources and Images’ in the IDE.

Click on ‘Add’, browse to the location of your style (i.e. C:PremiumPackiOS) and select the style (i.e. iOSJet.style). Then click on ‘Open’.

Change the name of the Resource Identifier to match the string in your code.

I then created the following OnCreate event for my Form:

procedure TForm1.FormCreate(Sender: TObject);
Style: TFMXObject;
Style := nil;
Style := TStyleManager.LoadFromResource(HInstance, ‘iOSJet’, RT_RCDATA);
Style := TStyleManager.LoadFromResource(HInstance, ‘AndroidJet’, RT_RCDATA);
if Style <> nil then

At runtime, on my iOS device, I see the iOSJet style, and on my Android device, I see the AndroidJet style.



Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Learn More About Upgrading

About author

Director of Product Management, Developer Tools Idera, Inc.
Related posts
DelphiRAD Studio

Get Started Building Cross-Platform Games In Delphi FireMonkey With Alien Invasion Sample


Ultimate Compression Toolkit For Delphi And C++ Builder Developers


RAD Studio with Delphi - The Original Low Code!


KisKis The Crazy Social Network For Android And iOS In Delphi

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.