Create Themes?
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- apowershelluser
- Posts: 194
- Last visit: Fri Mar 22, 2024 4:38 am
Create Themes?
How can I give my users the choice of themes that can be saved and loaded on next application launch?
- apowershelluser
- Posts: 194
- Last visit: Fri Mar 22, 2024 4:38 am
- apowershelluser
- Posts: 194
- Last visit: Fri Mar 22, 2024 4:38 am
Re: Create Themes?
So back again.. After seeing a few posts around I've came to the conclusion this is the best way I've found to do it
Create a new Registry Key, name it Colors, create Keys under there with your themes.. Then apply them using a button click Notice the Set-Theme string is blank, that's how I find what theme the user last left off with.
Is there a way to do this differently?
Create a new Registry Key, name it Colors, create Keys under there with your themes.. Then apply them using a button click Notice the Set-Theme string is blank, that's how I find what theme the user last left off with.
Is there a way to do this differently?
Re: Create Themes?
Load the whole key and assign the colors based on property name.
You should not create app specific keys at the root of the registry. Create an app key in the correct place and structure it correctly. This will allow each app to have a specific key for its settings.
It would be even better to use a CliXml file as this is easier to load and manage.
You mistake is in calling what you are doing a theme. WinForms does not support themes. WPF supports full theming. What you are doing is just assigning properties. This can also be more easily managed using data binding. All control properties support data binding so the assignment and saving is automated.
You should not create app specific keys at the root of the registry. Create an app key in the correct place and structure it correctly. This will allow each app to have a specific key for its settings.
It would be even better to use a CliXml file as this is easier to load and manage.
You mistake is in calling what you are doing a theme. WinForms does not support themes. WPF supports full theming. What you are doing is just assigning properties. This can also be more easily managed using data binding. All control properties support data binding so the assignment and saving is automated.
- apowershelluser
- Posts: 194
- Last visit: Fri Mar 22, 2024 4:38 am
Re: Create Themes?
If you only have a few simple control settings to change this can be a best method for automating settings. It can also be applied without using any variables because it telss you where the control is by name and what settings to override. The settings can be applied by looping through the hierarchy.
This allows an easy way to edit the settings and a way to apply them. Apply defaults from the script home folder then apply custom settings from the user profile parallel settings folder.
Code: Select all
<Form name="myform1">
<Property name="BackColor">LightGray</Property>
<Label name="label1">
<Property name="Color">Blue</Property>
<Property name="BackColor">Red</Property>
<Property name="Font">
<FontFamily>Microsoft Sans Serif</FontFamily>
<emSize>24.0</emSize>
<Style>Italic</Style>
</Property>
</Label>
</Form>
Re: Create Themes?
Just wanted to let you guys know I'm working on something for the next service release
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.