Screenshots:
Use styles in exe-files:
Normal GUI Styled GUI
If you create a project for a new exe-file, you can simply change the styles in the project-options menu:"Project > Options > Application > Appearance" ()
Use styles in dll-files: (Main part of this tutorial)
If you create a project for a dll-file, you don't have that simple option.
Borland gives you 2 functions to do this in your source-code, but:
Me and many others can't get the 1st one ("TStyleManager::LoadFromResource()") to work and the other one ("TStyleManager::LoadFromFile()") requires the styles to be on disc, and I don't want to drop any files to disc.
So after trying it out for hours I created an exe-file project and looked for the things, which define the style to be used, tried out manually adding these to the files of the dll-file project and it worked!
Solution:To use styles you need to insert into:
ProjectName.cbproj:
Anywhere in your code: (where you start your GUI for example)Code:[...] <PropertyGroup Condition="'$(Base)'!=''"> <ProjectType>CppDynamicLibrary</ProjectType> <VCL_Custom_Styles>"Ruby Graphite|VCLSTYLE|$(PUBLIC)\Documents\RAD Studio\9.0\Styles\RubyGraphite.vsf"</VCL_Custom_Styles> <Multithreaded>true</Multithreaded> [...] </PropertyGroup> [...]
Code:TStyleManager::TrySetStyle("Ruby Graphite"); // Name of the style is defined in the ProjectName.cbproj
I hope its helpful for anyone, I saw many people on the internet asking for a solution when I tried to find one, too.
Mi4uric3








