Embedding styles as resources
Let's have a look at the process of embedding custom styles into an app as a resource. Using custom resources is not limited to embedding. We can embed arbitrary files, for example, video, audio, custom graphics, data, or anything.
Remove the data module with style book components, because now we are going to load a custom style differently. In order to verify that the custom is loaded globally for all forms, we are going to add an additional form to the StyleTest app. Add an empty FireMonkey HD form to the project. Save the form's unit as uFormExtra
and change the Name
property of the new form to FormExtra
. Add the new form to the uses
clause of the main form. In the OnClick
event of the menu
speedbutton of the main form, add one line of code to display the new form.
The code will display FormExtra
when the end user clicks on the button:
uses uFormExtra; procedure TFormStylesTest.SpeedButton1Click(Sender: TObject); begin FormExtra.Show; end;
We will leave...