`
zbu57zbu
  • 浏览: 28134 次
社区版块
存档分类
最新评论

Winform Change skin(DevExpress commerical commponents)

 
阅读更多

  Create a basic Form public partial class FrmBase : DevExpress.XtraEditors.XtraForm { public FrmBase() { InitializeComponent(); defaultLookAndFeel1 = Common.GlobalValue.DefaultLookAndFeel; } } Define a static variable using System.Collections.Generic; public static class GlobalValue { private static DevExpress.LookAndFeel.DefaultLookAndFeel defaultLookAndFeel; public static DevExpress.LookAndFeel.DefaultLookAndFeel DefaultLookAndFeel { get { if (defaultLookAndFeel == null) { defaultLookAndFeel = new DevExpress.LookAndFeel.DefaultLookAndFeel(); defaultLookAndFeel.LookAndFeel.SkinName = "McSkin"; } return defaultLookAndFeel; } set { defaultLookAndFeel = value; } } } Design Menu private List LookAndFeelItems; private void FrmMain_Load(object sender, EventArgs e) { LookAndFeelItems = new List(); foreach (DevExpress.Skins.SkinContainer skin in DevExpress.Skins.SkinManager.Default.Skins) { BarCheckItem bci = new BarCheckItem(barManager1, false); bci.Caption = skin.SkinName; bci.CheckedChanged += new ItemClickEventHandler(bci_CheckedChanged); bsiLookAndFeel.AddItem(bci); LookAndFeelItems.Add(bci); if (IndexArb.Common.GlobalValue.DefaultLookAndFeel.Lo okAndFeel.SkinName == skin.SkinName) bci.Checked = true; } } private void bci_CheckedChanged(object sender, ItemClickEventArgs e) { BarCheckItem bci = (BarCheckItem)sender; if (!bci.Checked) return; foreach (var item in LookAndFeelItems) { if (bci == item) { IndexArb.Common.GlobalValue.DefaultLookAndFeel.Loo kAndFeel.SkinName = item.Caption; } else { item.Checked = false; } } } Then all the other forms inherit from the basic form.
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics