public AppearanceEditorUI(ButtonBar original) { this.original = original; appBar = (AppearanceBar)original.Appearance.Bar.Clone(); appItem = (AppearanceItem)original.Appearance.Item.Clone(); InitializeComponent(); pgrdBar.SelectedObject = original.Appearance.Bar; pgrdItem.SelectedObject = original.Appearance.Item; lbxTemplate.Items.AddRange(new object[] { Resources.THEME_VS2005, Resources.THEME_CLASSIC, Resources.THEME_BLUE, Resources.THEME_OLIVE, Resources.THEME_ROYAL, Resources.THEME_SILVER }); lbxTemplate.SelectedIndex = 0; bBar.Appearance.Bar.Assign(appBar); bBar.Appearance.Item.Assign(appItem); bBar.ThemeProperty.UseTheme = false; bBar.SetThemeDefaults(); bBar.RefreshControl(); lblCurrentStyle.Text = Resources.LBL_CURRENT_STYLE; lblApply.Text = Resources.LNK_APPLYTHEME; lblAvailableTheme.Text = Resources.LBL_AVAILABLE_THEME; lblLoad.Text = Resources.LNK_LOAD; lblPreview.Text = Resources.LBL_PREVIEW; lblReload.Text = Resources.LNK_RELOAD; lblReset.Text = Resources.LNK_RESET; lblSave.Text = Resources.LNK_SAVETHEME; Text = Resources.FORM_TEXT; }
private void SetColors(ColorSchemeDefinition def) { var currentBarStyle = (AppearanceBar)pgrdBar.SelectedObject; var currentItemStyle = (AppearanceItem)pgrdItem.SelectedObject; currentBarStyle.BackStyle.Assign(def.BarBackStyle); currentBarStyle.FocusedBorder = def.BarFocusedBorder; currentBarStyle.NormalBorder = def.BarNormalBorder; currentBarStyle.ResetAppearanceBorder(); currentBarStyle.ResetCornerRadius(); currentBarStyle.DisabledMask = def.DisabledMask; currentItemStyle.BackStyle.Assign(def.BackStyle); currentItemStyle.ClickStyle.Assign(def.ClickStyle); currentItemStyle.Gradient = def.GradientMode; currentItemStyle.HoverBorder = def.HoverBorder; currentItemStyle.HoverForeGround = def.HoverForeGround; currentItemStyle.HoverStyle.Assign(def.HoverStyle); currentItemStyle.NormalBorder = def.NormalBorder; currentItemStyle.NormalForeGround = def.NormalForeGround; currentItemStyle.SelectedBorder = def.SelectedBorder; currentItemStyle.SelectedForeGround = def.SelectedForeGround; currentItemStyle.SelectedHoverStyle.Assign(def.SelectedHoverStyle); currentItemStyle.SelectedStyle.Assign(def.SelectedStyle); currentItemStyle.DisabledStyle.Assign(def.DisabledStyle); currentItemStyle.DisabledBorder = def.DisabledBorder; currentItemStyle.DisabledForeGround = def.DisabledForeGround; bBar.Appearance.Bar.Assign(currentBarStyle); bBar.Appearance.Item.Assign(currentItemStyle); bBar.SetThemeDefaults(); original.Appearance.Bar.Assign(currentBarStyle); original.Appearance.Item.Assign(currentItemStyle); original.SetThemeDefaults(); }
protected virtual void Import() { using (var dlg = new OpenFileDialog()) { dlg.Filter = Resources.XML_FILE; if (dlg.ShowDialog() != DialogResult.OK) { return; } using (var fs = new FileStream(dlg.FileName, FileMode.Open)) { var serializer = new XmlSerializer(typeof(Appearance)); var app = (Layout.Appearance)serializer.Deserialize(fs); ButtonBar.Appearance.Assign(app); ButtonBar.SetThemeDefaults(); ButtonBar.Refresh(); } } }