具体步骤如下:
1、 在程序入口处,即Program.cs添加如下代码:
DevExpress.UserSkins.OfficeSkins.Register();
DevExpress.UserSkins.BonusSkins.Register();
2、 所应用样式窗体需要继承自DevExpress.XtraEditors.XtraForm;
3、 添加defaultLookAndFeel1控件;
4、 在应用窗体调用如下代码:
#region 初始化皮肤 private void InitSkin() { BarSubItem bar = new BarSubItem(); bar.Caption = "皮肤设置"; bar.Name = "皮肤设置"; //迭代出所有皮肤样式 foreach (DevExpress.Skins.SkinContainer skin in DevExpress.Skins.SkinManager.Default.Skins) { BarButtonItem barBI = new BarButtonItem(); barBI.Tag = skin.SkinName; barBI.Name = skin.SkinName; barBI.Caption = skin.SkinName; barBI.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(ItemClick); this.barManager1.Items.AddRange(new DevExpress.XtraBars.BarItem[] { barBI }); bar.LinksPersistInfo.AddRange(new DevExpress.XtraBars.LinkPersistInfo[] { new DevExpress.XtraBars.LinkPersistInfo(barBI) }); } this.barManager1.Items.AddRange(new DevExpress.XtraBars.BarItem[] { bar }); this.barMenu.LinksPersistInfo.AddRange(new DevExpress.XtraBars.LinkPersistInfo[] { new DevExpress.XtraBars.LinkPersistInfo(bar) }); } #region 皮肤单击事件 private void ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { defaultLookAndFeel1.LookAndFeel.SetSkinStyle(e.Item.Tag.ToString()); e.Item.Hint = e.Item.Tag.ToString(); } #endregion
本站文章除注明转载外,均为本站原创或翻译
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:DevExpress控件中文网 [https://www.devexpresscn.com/]
本文地址:https://www.devexpresscn.com/post/925.html
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:DevExpress控件中文网 [https://www.devexpresscn.com/]
本文地址:https://www.devexpresscn.com/post/925.html