public static void ShowColourEditorForm(string message) { string effectname = message.Substring(0, message.IndexOf(" ", StringComparison.Ordinal)); string text = message.Substring(message.IndexOf(" ", StringComparison.Ordinal) + 1); ButtonEffect effect = (ButtonEffect)Enum.Parse(typeof(ButtonEffect), effectname); ColourEditor newForm; if (editorForms.ContainsKey(effect)) { if (editorForms.TryGetValue(effect, out newForm)) { newForm.BringToFront(); return; } } newForm = new ColourEditor(effect, text); PositionColourEditorForm(newForm); editorForms.Add(effect, newForm); newForm.FormClosed += ChildFormClosed; newForm.Show(_mainForm); }
private static Point GetColourEditorFormStartingPosition(ColourEditor ce) { if (_colourMapForm != null) { // Start from top right of colour map return(GetNewLocation(_colourMapForm, ce, ChildFormPosition.TopRight)); } return(GetNewLocation(_mainForm, ChildFormPosition.BottomLeft)); // Risque as isn't a child, but will work. }
public static void CloseAllEditorForms() { foreach (ButtonEffect effect in Enum.GetValues(typeof(ButtonEffect))) { if (editorForms.ContainsKey(effect)) { ColourEditor ce = editorForms[effect]; if (ce != null) { ce.Close(); } } } }
private static void PositionColourEditorForm(ColourEditor ce) { // Now, where to put it.. // TODO - Why is this value not being used? Point formLocation = GetColourEditorFormStartingPosition(ce); // If there are no other forms use the last closed position (if there is one) // (current form must be new and hasn't been added to collection yet) if (editorForms.Count == 0) { Properties.Settings userSettings = new Properties.Settings(); Point savedLocation = userSettings.ColourEditorLocation; if (savedLocation == Point.Empty) { // Colour Map form must be open as we must be spawning a new editor (as the count is zero) formLocation = GetNewLocation(_colourMapForm, ce, ChildFormPosition.TopRight); } else { formLocation = savedLocation; } } else { // There are 1-many forms open. They could be all over the screen: // pick the bottommost rightmost one and cascade off it // (Using top left means having to find the topleftmost form // that isn't cascaded, Point p = new Point(-5000, -5000); foreach (ColourEditor openform in editorForms.Values) { if (openform == null || openform == ce) { continue; } if (openform.Location.X > p.X && openform.Location.Y > p.Y) { p = openform.Location; } } formLocation = new Point(p.X + 10, p.Y + SystemInformation.CaptionHeight + 5); } ce.Location = formLocation; }
public static void ChildFormClosed(object sender, FormClosedEventArgs e) { if (sender is ColourMap) { _colourMapForm = null; } else if (sender is MappingListForm) { _mapListForm = null; } else if (sender is HelpForm) { _helpForm = null; } else if (sender is ColourEditor) { ColourEditor ce = (ColourEditor)sender; if (editorForms.ContainsKey(ce.Effect)) { editorForms.Remove(ce.Effect); } } _mainForm.RegenerateMenuExternal(); }
private void InitializeComponent() { this.kpnlMain = new ComponentFactory.Krypton.Toolkit.KryptonPanel(); this.kbtnSaveColourPalette = new ComponentFactory.Krypton.Toolkit.KryptonButton(); this.kbtnLoadColourPalette = new ComponentFactory.Krypton.Toolkit.KryptonButton(); this.scpPicker = new ExtendedColourControls.ScreenColourPicker(); this.ceColour = new ExtendedColourControls.ColourEditor(); this.ceEditor = new Cyotek.Windows.Forms.ColorEditor(); this.kbtnCancel = new ComponentFactory.Krypton.Toolkit.KryptonButton(); this.kbtnOk = new ComponentFactory.Krypton.Toolkit.KryptonButton(); this.cbColourPreview = new KryptonToolkitSuiteExtendedCore.CircularPictureBox(); this.cwColourPicker = new ExtendedColourControls.ColourWheel(); this.cgColourPalette = new Cyotek.Windows.Forms.ColorGrid(); this.cem = new ExtendedColourControls.ColourEditorManager(); ((System.ComponentModel.ISupportInitialize)(this.kpnlMain)).BeginInit(); this.kpnlMain.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.cbColourPreview)).BeginInit(); this.SuspendLayout(); // // kpnlMain // this.kpnlMain.Controls.Add(this.kbtnSaveColourPalette); this.kpnlMain.Controls.Add(this.kbtnLoadColourPalette); this.kpnlMain.Controls.Add(this.scpPicker); this.kpnlMain.Controls.Add(this.ceColour); this.kpnlMain.Controls.Add(this.ceEditor); this.kpnlMain.Controls.Add(this.kbtnCancel); this.kpnlMain.Controls.Add(this.kbtnOk); this.kpnlMain.Controls.Add(this.cbColourPreview); this.kpnlMain.Controls.Add(this.cwColourPicker); this.kpnlMain.Controls.Add(this.cgColourPalette); this.kpnlMain.Dock = System.Windows.Forms.DockStyle.Fill; this.kpnlMain.Location = new System.Drawing.Point(0, 0); this.kpnlMain.Name = "kpnlMain"; this.kpnlMain.Size = new System.Drawing.Size(643, 483); this.kpnlMain.TabIndex = 0; // // kbtnSaveColourPalette // this.kbtnSaveColourPalette.Location = new System.Drawing.Point(41, 300); this.kbtnSaveColourPalette.Name = "kbtnSaveColourPalette"; this.kbtnSaveColourPalette.Size = new System.Drawing.Size(23, 23); this.kbtnSaveColourPalette.TabIndex = 5; this.kbtnSaveColourPalette.Values.Image = global::ExtendedColourControls.Properties.Resources.palette_save; this.kbtnSaveColourPalette.Values.Text = ""; this.kbtnSaveColourPalette.Click += new System.EventHandler(this.KbtnSaveColourPalette_Click); // // kbtnLoadColourPalette // this.kbtnLoadColourPalette.Location = new System.Drawing.Point(12, 300); this.kbtnLoadColourPalette.Name = "kbtnLoadColourPalette"; this.kbtnLoadColourPalette.Size = new System.Drawing.Size(23, 23); this.kbtnLoadColourPalette.TabIndex = 1; this.kbtnLoadColourPalette.Values.Image = global::ExtendedColourControls.Properties.Resources.palette_load; this.kbtnLoadColourPalette.Values.Text = ""; this.kbtnLoadColourPalette.Click += new System.EventHandler(this.KbtnLoadColourPalette_Click); // // scpPicker // this.scpPicker.Colour = System.Drawing.Color.Empty; this.scpPicker.Image = global::ExtendedColourControls.Properties.Resources.eyedropper1; this.scpPicker.Location = new System.Drawing.Point(501, 164); this.scpPicker.Name = "scpPicker"; this.scpPicker.Size = new System.Drawing.Size(130, 129); // // ceColour // this.ceColour.BackColor = System.Drawing.Color.Transparent; this.ceColour.Location = new System.Drawing.Point(249, 20); this.ceColour.Name = "ceColour"; this.ceColour.Size = new System.Drawing.Size(246, 371); this.ceColour.TabIndex = 1; // // ceEditor // this.ceEditor.BackColor = System.Drawing.Color.Transparent; this.ceEditor.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.ceEditor.Location = new System.Drawing.Point(249, 20); this.ceEditor.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.ceEditor.Name = "ceEditor"; this.ceEditor.Size = new System.Drawing.Size(246, 371); this.ceEditor.TabIndex = 1; this.ceEditor.Visible = false; // // kbtnCancel // this.kbtnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.kbtnCancel.Location = new System.Drawing.Point(501, 64); this.kbtnCancel.Name = "kbtnCancel"; this.kbtnCancel.Size = new System.Drawing.Size(130, 38); this.kbtnCancel.StateCommon.Content.LongText.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.kbtnCancel.StateCommon.Content.ShortText.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.kbtnCancel.TabIndex = 4; this.kbtnCancel.Values.Text = "C&ancel"; this.kbtnCancel.Click += new System.EventHandler(this.KbtnCancel_Click); // // kbtnOk // this.kbtnOk.Location = new System.Drawing.Point(501, 20); this.kbtnOk.Name = "kbtnOk"; this.kbtnOk.Size = new System.Drawing.Size(130, 38); this.kbtnOk.StateCommon.Content.LongText.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.kbtnOk.StateCommon.Content.ShortText.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.kbtnOk.TabIndex = 3; this.kbtnOk.Values.Text = "&Ok"; this.kbtnOk.Click += new System.EventHandler(this.KbtnOk_Click); // // cbColourPreview // this.cbColourPreview.BackColor = System.Drawing.SystemColors.Control; this.cbColourPreview.Location = new System.Drawing.Point(501, 341); this.cbColourPreview.Name = "cbColourPreview"; this.cbColourPreview.Size = new System.Drawing.Size(130, 130); this.cbColourPreview.TabIndex = 2; this.cbColourPreview.TabStop = false; this.cbColourPreview.Paint += new System.Windows.Forms.PaintEventHandler(this.CbColourPreview_Paint); // // cwColourPicker // this.cwColourPicker.BackColor = System.Drawing.Color.Transparent; this.cwColourPicker.Location = new System.Drawing.Point(12, 20); this.cwColourPicker.Name = "cwColourPicker"; this.cwColourPicker.Size = new System.Drawing.Size(231, 212); this.cwColourPicker.TabIndex = 1; // // cgColourPalette // this.cgColourPalette.AutoAddColors = false; this.cgColourPalette.BackColor = System.Drawing.Color.Transparent; this.cgColourPalette.CellSize = new System.Drawing.Size(11, 12); this.cgColourPalette.EditMode = Cyotek.Windows.Forms.ColorEditingMode.Both; this.cgColourPalette.Location = new System.Drawing.Point(12, 329); this.cgColourPalette.Name = "cgColourPalette"; this.cgColourPalette.SelectedCellStyle = Cyotek.Windows.Forms.ColorGridSelectedCellStyle.Standard; this.cgColourPalette.ShowCustomColors = false; this.cgColourPalette.Size = new System.Drawing.Size(231, 142); this.cgColourPalette.TabIndex = 1; this.cgColourPalette.EditingColor += new System.EventHandler <Cyotek.Windows.Forms.EditColorCancelEventArgs>(this.CgColourPalette_EditingColor); // // cem // this.cem.Color = System.Drawing.Color.Empty; this.cem.ColourEditor = this.ceColour; this.cem.ColourGrid = this.cgColourPalette; this.cem.ColourWheel = this.cwColourPicker; this.cem.ScreenColourPicker = this.scpPicker; this.cem.ColorChanged += new System.EventHandler(this.Cem_ColorChanged); this.cem.ColourChanged += new System.EventHandler(this.Cem_ColourChanged); // // ColourPickerDialog // this.AcceptButton = this.kbtnOk; this.CancelButton = this.kbtnCancel; this.ClientSize = new System.Drawing.Size(643, 483); this.Controls.Add(this.kpnlMain); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "ColourPickerDialog"; this.ShowIcon = false; this.ShowInTaskbar = false; this.Text = "Colour Picker"; this.Load += new System.EventHandler(this.ColourPickerDialog_Load); ((System.ComponentModel.ISupportInitialize)(this.kpnlMain)).EndInit(); this.kpnlMain.ResumeLayout(false); this.kpnlMain.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.cbColourPreview)).EndInit(); this.ResumeLayout(false); }
private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(KryptonColourPickerDialog)); this.kryptonPanel1 = new Krypton.Toolkit.KryptonPanel(); this.kdbtnOk = new Krypton.Toolkit.Suite.Extended.Base.KryptonOKDialogButton(); this.kdbtnCancel = new Krypton.Toolkit.Suite.Extended.Base.KryptonCancelDialogButton(); this.kryptonPanel2 = new Krypton.Toolkit.KryptonPanel(); this.kbtnSavePalette = new Krypton.Toolkit.KryptonButton(); this.kbtnLoadPalette = new Krypton.Toolkit.KryptonButton(); this.cpbColour = new Krypton.Toolkit.Suite.Extended.Base.CircularPictureBox(); this.cgColour = new Cyotek.Windows.Forms.ColorGrid(); this.scpColour = new Krypton.Toolkit.Suite.Extended.Drawing.Suite.ScreenColourPickerControl(); this.ceColour = new Krypton.Toolkit.Suite.Extended.Drawing.Suite.ColourEditor(); this.cwColour = new Krypton.Toolkit.Suite.Extended.Drawing.Suite.ColourWheelControl(); this.panel1 = new System.Windows.Forms.Panel(); this.cem = new Krypton.Toolkit.Suite.Extended.Drawing.Suite.ColourEditorManager(); ((System.ComponentModel.ISupportInitialize)(this.kryptonPanel1)).BeginInit(); this.kryptonPanel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.kryptonPanel2)).BeginInit(); this.kryptonPanel2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.cpbColour)).BeginInit(); this.SuspendLayout(); // // kryptonPanel1 // this.kryptonPanel1.Controls.Add(this.kdbtnOk); this.kryptonPanel1.Controls.Add(this.kdbtnCancel); this.kryptonPanel1.Dock = System.Windows.Forms.DockStyle.Bottom; this.kryptonPanel1.Location = new System.Drawing.Point(0, 411); this.kryptonPanel1.Name = "kryptonPanel1"; this.kryptonPanel1.Size = new System.Drawing.Size(644, 43); this.kryptonPanel1.TabIndex = 0; // // kdbtnOk // this.kdbtnOk.DialogResult = System.Windows.Forms.DialogResult.OK; this.kdbtnOk.Location = new System.Drawing.Point(446, 6); this.kdbtnOk.Name = "kdbtnOk"; this.kdbtnOk.ParentWindow = null; this.kdbtnOk.Size = new System.Drawing.Size(90, 25); this.kdbtnOk.TabIndex = 3; this.kdbtnOk.Values.Text = "&OK"; this.kdbtnOk.Click += new System.EventHandler(this.kdbtnOk_Click); // // kdbtnCancel // this.kdbtnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.kdbtnCancel.Location = new System.Drawing.Point(542, 6); this.kdbtnCancel.Name = "kdbtnCancel"; this.kdbtnCancel.ParentWindow = null; this.kdbtnCancel.Size = new System.Drawing.Size(90, 25); this.kdbtnCancel.TabIndex = 3; this.kdbtnCancel.Values.Text = "C&ancel"; this.kdbtnCancel.Click += new System.EventHandler(this.kdbtnCancel_Click); // // kryptonPanel2 // this.kryptonPanel2.Controls.Add(this.kbtnSavePalette); this.kryptonPanel2.Controls.Add(this.kbtnLoadPalette); this.kryptonPanel2.Controls.Add(this.cpbColour); this.kryptonPanel2.Controls.Add(this.cgColour); this.kryptonPanel2.Controls.Add(this.scpColour); this.kryptonPanel2.Controls.Add(this.ceColour); this.kryptonPanel2.Controls.Add(this.cwColour); this.kryptonPanel2.Dock = System.Windows.Forms.DockStyle.Fill; this.kryptonPanel2.Location = new System.Drawing.Point(0, 0); this.kryptonPanel2.Name = "kryptonPanel2"; this.kryptonPanel2.Size = new System.Drawing.Size(644, 411); this.kryptonPanel2.TabIndex = 1; // // kbtnSavePalette // this.kbtnSavePalette.AutoSize = true; this.kbtnSavePalette.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.kbtnSavePalette.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.kbtnSavePalette.Location = new System.Drawing.Point(40, 203); this.kbtnSavePalette.Name = "kbtnSavePalette"; this.kbtnSavePalette.Size = new System.Drawing.Size(22, 22); this.kbtnSavePalette.TabIndex = 4; this.kbtnSavePalette.ToolTipValues.Description = "Save a custom palette."; this.kbtnSavePalette.ToolTipValues.EnableToolTips = true; this.kbtnSavePalette.ToolTipValues.Heading = "Save Palette"; this.kbtnSavePalette.ToolTipValues.Image = global::Krypton.Toolkit.Suite.Extended.Drawing.Suite.Properties.Resources.palette_save; this.kbtnSavePalette.Values.Image = global::Krypton.Toolkit.Suite.Extended.Drawing.Suite.Properties.Resources.palette_save; this.kbtnSavePalette.Values.Text = ""; this.kbtnSavePalette.Click += new System.EventHandler(this.kbtnSavePalette_Click); // // kbtnLoadPalette // this.kbtnLoadPalette.AutoSize = true; this.kbtnLoadPalette.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.kbtnLoadPalette.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.kbtnLoadPalette.Location = new System.Drawing.Point(12, 203); this.kbtnLoadPalette.Name = "kbtnLoadPalette"; this.kbtnLoadPalette.Size = new System.Drawing.Size(22, 22); this.kbtnLoadPalette.TabIndex = 3; this.kbtnLoadPalette.ToolTipValues.Description = "Load a custom palette."; this.kbtnLoadPalette.ToolTipValues.EnableToolTips = true; this.kbtnLoadPalette.ToolTipValues.Heading = "Load Palette"; this.kbtnLoadPalette.ToolTipValues.Image = global::Krypton.Toolkit.Suite.Extended.Drawing.Suite.Properties.Resources.palette_load; this.kbtnLoadPalette.Values.Image = global::Krypton.Toolkit.Suite.Extended.Drawing.Suite.Properties.Resources.palette_load; this.kbtnLoadPalette.Values.Text = ""; this.kbtnLoadPalette.Click += new System.EventHandler(this.kbtnLoadPalette_Click); // // cpbColour // this.cpbColour.BackColor = System.Drawing.Color.Transparent; this.cpbColour.Location = new System.Drawing.Point(458, 12); this.cpbColour.Name = "cpbColour"; this.cpbColour.Size = new System.Drawing.Size(174, 167); this.cpbColour.TabIndex = 3; this.cpbColour.TabStop = false; this.cpbColour.ToolTipValues = null; // // cgColour // this.cgColour.BackColor = System.Drawing.Color.Transparent; this.cgColour.Location = new System.Drawing.Point(12, 231); this.cgColour.Name = "cgColour"; this.cgColour.Size = new System.Drawing.Size(247, 165); this.cgColour.TabIndex = 3; this.cgColour.EditingColor += new System.EventHandler <Cyotek.Windows.Forms.EditColorCancelEventArgs>(this.cgColour_EditingColor); this.cgColour.ColorChanged += new System.EventHandler(this.cgColour_ColorChanged); // // scpColour // this.scpColour.Colour = System.Drawing.Color.Empty; this.scpColour.Image = global::Krypton.Toolkit.Suite.Extended.Drawing.Suite.Properties.Resources.eyedropper; this.scpColour.Location = new System.Drawing.Point(267, 261); this.scpColour.Name = "scpColour"; this.scpColour.Size = new System.Drawing.Size(185, 135); // // ceColour // this.ceColour.BackColor = System.Drawing.Color.Transparent; this.ceColour.Location = new System.Drawing.Point(267, 12); this.ceColour.Name = "ceColour"; this.ceColour.Size = new System.Drawing.Size(185, 243); this.ceColour.TabIndex = 3; // // cwColour // this.cwColour.BackColor = System.Drawing.Color.Transparent; this.cwColour.Location = new System.Drawing.Point(12, 12); this.cwColour.Name = "cwColour"; this.cwColour.Size = new System.Drawing.Size(249, 183); this.cwColour.TabIndex = 0; this.cwColour.ColourChanged += new System.EventHandler(this.cwColour_ColourChanged); // // panel1 // this.panel1.BackColor = System.Drawing.SystemColors.ControlDarkDark; this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom; this.panel1.Location = new System.Drawing.Point(0, 408); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(644, 3); this.panel1.TabIndex = 2; // // cem // this.cem.Color = System.Drawing.Color.Empty; this.cem.ColourEditor = this.ceColour; this.cem.ColourWheel = this.cwColour; this.cem.ColorChanged += new System.EventHandler(this.cem_ColorChanged); this.cem.ColourChanged += new System.EventHandler(this.cem_ColourChanged); // // KryptonColourPickerDialog // this.AcceptButton = this.kdbtnOk; this.CancelButton = this.kdbtnCancel; this.ClientSize = new System.Drawing.Size(644, 454); this.Controls.Add(this.panel1); this.Controls.Add(this.kryptonPanel2); this.Controls.Add(this.kryptonPanel1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "KryptonColourPickerDialog"; this.ShowIcon = false; this.ShowInTaskbar = false; this.Text = "Select a Colour"; ((System.ComponentModel.ISupportInitialize)(this.kryptonPanel1)).EndInit(); this.kryptonPanel1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.kryptonPanel2)).EndInit(); this.kryptonPanel2.ResumeLayout(false); this.kryptonPanel2.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.cpbColour)).EndInit(); this.ResumeLayout(false); }