/// <summary> /// Initializes a new instance of the <see cref="AppearanceEditorUI"/> class. /// </summary> /// <param name="original">The original.</param> public AppearanceEditorUI(ZeroitToxicButton 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[] { Properties.Resources.THEME_VS2005, Properties.Resources.THEME_CLASSIC, Properties.Resources.THEME_BLUE, Properties.Resources.THEME_OLIVE, Properties.Resources.THEME_ROYAL, Properties.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 = Properties.Resources.LBL_CURRENT_STYLE; lblApply.Text = Properties.Resources.LNK_APPLYTHEME; lblAvailableTheme.Text = Properties.Resources.LBL_AVAILABLE_THEME; lblLoad.Text = Properties.Resources.LNK_LOAD; lblPreview.Text = Properties.Resources.LBL_PREVIEW; lblReload.Text = Properties.Resources.LNK_RELOAD; lblReset.Text = Properties.Resources.LNK_RESET; lblSave.Text = Properties.Resources.LNK_SAVETHEME; Text = Properties.Resources.FORM_TEXT; }
/// <summary> /// Sets the colors. /// </summary> /// <param name="def">The definition.</param> 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(); }
/// <summary> /// Imports this instance. /// </summary> protected virtual void Import() { using (var dlg = new OpenFileDialog()) { dlg.Filter = Properties.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 = (Zeroit.Framework.MiscControls.Appearance)serializer.Deserialize(fs); ZeroitToxicButton.Appearance.Assign(app); ZeroitToxicButton.SetThemeDefaults(); ZeroitToxicButton.Refresh(); } } }