In fact, "skin" is just a very small part of dxperience, or just a functional point. Let me briefly talk about the skin Replacement Operation of dxperience.
Prepare program. CS and frmmain. CS.
1. Drag a devexpress. xtraeditors. comboboxedit control from the toolbox to the frmmain. CS form. Shows the position of the comboboxedit control in the toolbox:
2. Add the selectedindexchanged event Method to the comboboxedit control to implement the default skin function of the form after the comboboxedit control option is changed. The Code is as follows:
1 private void comboboxedit1_selectedindexchanged (Object sender, eventargs E)
2 {
3 string skinname = comboboxedit1.editvalue. tostring ();
4 devexpress. lookandfeel. userlookandfeel. Default. skinname = skinname;
5}
3. added the frmmain. CS form load event method to implement the comboboxedit control option function after the frmmain. CS form is loaded. The Code is as follows:
1 private void frmmain_load (Object sender, eventargs E)
2 {
3 comboboxedit1.properties. texteditstyle = devexpress. xtraeditors. Controls. texteditstyles. disabletexteditor;
4 initskinlist ();
5}
6
7 /// <summary>
8 // initialize the skin style list
9 /// </Summary>
10 private void initskinlist ()
11 {
12 foreach (devexpress. Skins. skincontainer in devexpress. Skins. skinmanager. Default. skins)
13 {
14 comboboxedit1.properties. Items. Add (skincontainer. skinname );
15}
16
17 if (comboboxedit1.properties. Items. Count> 0)
18 comboboxedit1.selectedindex = 0;
19}
3. Press F5 to start debugging and you will see the actual effect. As shown in:
You can select different items from the skin style drop-down list to view the changes.