Description:
This article describes how to load skins dynamically by using .SKINRES files
Answer:
First of all, it is necessary to save your skin project, containing one or more Skins, in a single .SKINRES file. For additional information on how to create your own skin project, please refer to the "How to Create Skins Using the Skin Editor" help topic and related topics.
Then you can populate any list of the TStrings type with your custom skins' names. This list will allow you to display available skin names in an appropriate control/editor (for example, TcxComboBox). To accomplish this, you can call the dxSkinsUserSkinPopulateSkinNames function as follows:
DelphidxSkinsUserSkinPopulateSkinNames(AFileName, AComboBox.Properties.Items);
After that, you can handle the editor's OnEditValueChanged event (or any other event that indicates that the control's current value is changed) to change the current skin according to the name selected in the control. In this event, it is necessary to load the corresponding skin from your .SKINRES file (use the dxSkinsUserSkinLoadFromFile method to accomplish this task), set the dxSkinController's SkinName property value to 'UserSkin', and call the dxSkinController's Refresh method. You can also change the dxRibbon's color scheme the same way. Just set the Ribbon.ColorSchemeName property value to 'UserSkin'.
You can find a small demo project demonstrating how to use our TcxComboBox to load a skin dynamically. Alternatively, you can use any other control you wish.
Is there any particular reason to set SkinName to 'UserSkin' ?
I tried to set SkinName to cxCombobox1.Text and it works too
what's the difference between 'UserSkin' and .Text ?
In My case, i want to use different skin for form and control.
For example :
form skin = office2013white ===> set from dxSkinController1 ===>comboboxFormSkin
control skin = office2010blue ===> set from dxLayoutSkinLookAndFeel1 ===>comboboxControlSkin
my controls are inside dxLayoutControl with dxLayoutControl's LookAndFeel set to dxLayoutSkinLookAndFeel1
in comboboxFormSkin onPropertiesEditValueChange :
dxSkinController1.SkinName := 'UserSkin'
in comboboxControlSkin onPropertiesEditValueChange :
dxLayoutSkinLookAndFeel1.LookAndFeel.SkinName:='UserSkin'
when I choose skin from comboboxControlSkin, "both" form and control skin changed to the selected skin
and after that, even comboboxFormSkin will also change control skin (comboboxFormSkin works correctly if comboboxControlSkin's value is not changed yet)
the correct behavior is : comboboxFormSkin will change form skin, and comboboxControlSkin change control skin
this behavior is achieved correctly with SkinName := combobox(form / control)skin.Text
why it is not achieved with SkinName := 'UserSkin' ?
thank you
Hello,
To process your recent post more efficiently, I created a separate ticket on your behalf: T234373: Is there any particular reason to set SkinName to UserSkin?. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.