//根据配置文件加载窗体风格 private void loadUserStyleProfile() { try { userStyle = ConfigurationManager.GetConfiguration(USERSTYLEPROFILE_CONFIG_NAME) as UserStyle; string windowsStyle = userStyle.StyleName; string windowsSkin = userStyle.SkinName; if(windowsStyle.Equals("Default")) { DevExpress.LookAndFeel.UserLookAndFeel.Default.SetDefaultStyle(); } else if(windowsStyle.Equals("WindowsXP")) { DevExpress.LookAndFeel.UserLookAndFeel.Default.SetWindowsXPStyle(); } else if(windowsStyle.Equals("OfficeXP")) { DevExpress.LookAndFeel.UserLookAndFeel.Default.SetOffice2003Style(); } else if(windowsStyle.Equals("Office2000")) { DevExpress.LookAndFeel.UserLookAndFeel.Default.SetDefaultStyle(); } else if(windowsStyle.Equals("Office2003")) { DevExpress.LookAndFeel.UserLookAndFeel.Default.SetOffice2003Style(); } else if(windowsStyle.Equals("Skin")) { DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle(windowsSkin); } } catch(Exception ex) { MessageBox.Show(ex.Message,"系统信息",MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public MainForm() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // userStyle = new UserStyle(); MenuDisplayByRole(); //加载皮肤名称集 loadSkinName(); //加载用户选择的窗体风格信息 loadUserStyleProfile(); healthManagementSystem = new HealthManagementSystem(); utilSystem = new UtilSystem(); #if DisableSessionTimeout timerSynSession.Enabled = false; #endif }
//如果上次用户选择过窗体风格则加载上次选择的风格,否则加载默认的风格 private void loadUserStyleProfile() { try { userStyle = ConfigurationManager.GetConfiguration(USERSTYLEPROFILE_CONFIG_NAME) as UserStyle; string windowsStyle = userStyle.StyleName; string windowsSkin = userStyle.SkinName; if(windowsStyle.Equals("Default")) { barManager_Main.GetController().PaintStyleName = "Default"; barManager_Main.GetController().ResetStyleDefaults(); DevExpress.LookAndFeel.UserLookAndFeel.Default.SetDefaultStyle(); } else if(windowsStyle.Equals("WindowsXP")) { barManager_Main.GetController().PaintStyleName = "WindowsXP"; barManager_Main.GetController().ResetStyleDefaults(); DevExpress.LookAndFeel.UserLookAndFeel.Default.SetWindowsXPStyle(); navBarControl_Main.View = new DevExpress.XtraNavBar.ViewInfo.AdvExplorerBarViewInfoRegistrator(); } else if(windowsStyle.Equals("OfficeXP")) { barManager_Main.GetController().PaintStyleName = "OfficeXP"; barManager_Main.GetController().ResetStyleDefaults(); DevExpress.LookAndFeel.UserLookAndFeel.Default.SetOffice2003Style(); navBarControl_Main.View = new DevExpress.XtraNavBar.ViewInfo.Office3ViewInfoRegistrator(); } else if(windowsStyle.Equals("Office2000")) { barManager_Main.GetController().PaintStyleName = "Office2000"; barManager_Main.GetController().ResetStyleDefaults(); DevExpress.LookAndFeel.UserLookAndFeel.Default.SetDefaultStyle(); navBarControl_Main.View = new DevExpress.XtraNavBar.ViewInfo.BaseViewInfoRegistrator(); } else if(windowsStyle.Equals("Office2003")) { barManager_Main.GetController().PaintStyleName = "Office2003"; barManager_Main.GetController().ResetStyleDefaults(); DevExpress.LookAndFeel.UserLookAndFeel.Default.SetOffice2003Style(); navBarControl_Main.View = new DevExpress.XtraNavBar.ViewInfo.NavigationPaneViewInfoRegistrator(); } else if(windowsStyle.Equals("Skin")) { DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle(windowsSkin); barManager_Main.GetController().PaintStyleName = "Skin"; } } catch(Exception ex) { MessageBox.Show(ex.Message,"系统信息",MessageBoxButtons.OK, MessageBoxIcon.Information); } }