Devexpress is used today and I think about skin replacement. I have referred to Boyou.Devexpress skin change hands tutorial,
This article has already enabled form skin replacement, but how to set the skin for opening the form in the future is not mentioned, but it can be implemented with a slight extension.
I like simplification of complex problems. It is much easier to do so based on tannaiyin.
Step 1All forms are inherited from devexpress. xtraeditors. xtraform.
Step 2: Add two references:
Devexpress. bonusskins. v9.2
Devexpress. officeskins. v9.2
Step 3: The first line of the main function of the program class at the software entryCodeAdd:
Devexpress. userskins. bonusskins. Register ();
Devexpress. userskins. officeskins. Register ();
Devexpress. Skins. skinmanager. enableformskins ();
Application. enablevisualstyles ();
Application. setcompatibletextrenderingdefault (false );
Application. Run (New formmain ());
Step 4
Create a form base class, Add
1 Public ClassFrmbase: devexpress. xtraeditors. xtraform
2 {
3 Protected Static Devexpress. lookandfeel. defalooklookandfeel = New Devexpress. lookandfeel. defaultlookandfeel ();
4 }
Step 5: The new form inherits from the frmbase
Step 6On one of the formsEnumerate all skins and place them in a comboboxedit file. The Code is as follows:
Foreach (devexpress. Skins. skincontainer skin devexpress. Skins. skinmanager. Default. skins)
Cmbappstyle. properties. Items. Add (skin. skinname );
Part 7Set skin. How to Set skin?Base ClassThe defaultlookandfeel code is as follows:Frmbase. defaultlookandfeel. lookandfeel. skinname=Cmbappstyle. editvalue. tostring ();
ThisIn this way, all the forms in the entire project can be replaced at the same time.