How to Apply Custom Skins in the Application
- 2 minutes to read
This topic describes how you can use custom skins (created with the Skin Editor) in your application.
The Skin Editor saves skin design in the following files:
A compiled resource file (a .RES file) – contains all the skins created in the Skin Editor.
A unit file (a .PAS file) – contains a link to the resource, and specifies names for skins contained in the resource file (the specified skin names are the same as defined in the Skin Editor).
Delphi and C++ Builder package files (.DPK, .BPK, and .CPP files) – required to make the newly created skins available in the IDE.
To apply new skins to the application interface, do the following:
Place the generated .RES and .PAS files into your application project’s folder (or specify the path to the project folder via the Add to Project file dialog in your IDE). Specify the unit name in the ‘uses’ clause of your application.
Install the generated skin packages into the IDE.
Dynamic Skin Loading
You can dynamically load skins to reduce memory use in skinned applications. This allows you to have only one skin loaded in your application at one time, provided that you don’t use built-in and custom skin units.
To accomplish this, do the following:
In the Skin Editor, save your skin project to a binary file (.SKINRES file).
Call the dxSkinsUserSkinLoadFromFile global function to load a skin from a .SKINRES file. To load a skin from a stream, call the dxSkinsUserSkinLoadFromStream global function.
Set the SkinName property to ‘UserSkin’ to apply the loaded skin.