diff --git a/src/Greenshot.Addon.LegacyEditor/Controls/ColorDialog.Designer.cs b/src/Greenshot.Addon.LegacyEditor/Controls/ColorDialog.Designer.cs index ddcddd3f0..7ff1e7644 100644 --- a/src/Greenshot.Addon.LegacyEditor/Controls/ColorDialog.Designer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Controls/ColorDialog.Designer.cs @@ -65,6 +65,8 @@ namespace Greenshot.Addon.LegacyEditor.Controls { this.labelAlpha = new Greenshot.Addons.Controls.GreenshotLabel(); this.btnApply = new Greenshot.Addons.Controls.GreenshotButton(); this.pipette = new Greenshot.Addon.LegacyEditor.Controls.Pipette(); + this.panelColors = new System.Windows.Forms.Panel(); + this.panelRecentColors = new System.Windows.Forms.Panel(); this.SuspendLayout(); // // btnTransparent @@ -184,7 +186,7 @@ namespace Greenshot.Addon.LegacyEditor.Controls { // labelRecentColors // this.labelRecentColors.LanguageKey = "colorpicker_recentcolors"; - this.labelRecentColors.Location = new System.Drawing.Point(0, 335); + this.labelRecentColors.Location = new System.Drawing.Point(0, 337); this.labelRecentColors.Name = "labelRecentColors"; this.labelRecentColors.Size = new System.Drawing.Size(411, 30); this.labelRecentColors.TabIndex = 10; @@ -239,11 +241,27 @@ namespace Greenshot.Addon.LegacyEditor.Controls { this.pipette.TabIndex = 13; this.pipette.PipetteUsed += new System.EventHandler(this.PipetteUsed); // + // panelColors + // + this.panelColors.Location = new System.Drawing.Point(5, 7); + this.panelColors.Name = "panelColors"; + this.panelColors.Size = new System.Drawing.Size(406, 328); + this.panelColors.TabIndex = 14; + // + // panelRecentColors + // + this.panelRecentColors.Location = new System.Drawing.Point(5, 366); + this.panelRecentColors.Name = "panelRecentColors"; + this.panelRecentColors.Size = new System.Drawing.Size(406, 30); + this.panelRecentColors.TabIndex = 15; + // // ColorDialog // this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 25F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(584, 404); + this.Controls.Add(this.panelRecentColors); + this.Controls.Add(this.panelColors); this.Controls.Add(this.pipette); this.Controls.Add(this.btnApply); this.Controls.Add(this.textBoxAlpha); @@ -289,5 +307,7 @@ namespace Greenshot.Addon.LegacyEditor.Controls { private System.Windows.Forms.Panel colorPanel; private GreenshotButton btnTransparent; private Pipette pipette; - } + private System.Windows.Forms.Panel panelColors; + private System.Windows.Forms.Panel panelRecentColors; + } } diff --git a/src/Greenshot.Addon.LegacyEditor/Controls/ColorDialog.cs b/src/Greenshot.Addon.LegacyEditor/Controls/ColorDialog.cs index 616d769c7..329d80527 100644 --- a/src/Greenshot.Addon.LegacyEditor/Controls/ColorDialog.cs +++ b/src/Greenshot.Addon.LegacyEditor/Controls/ColorDialog.cs @@ -45,7 +45,6 @@ namespace Greenshot.Addon.LegacyEditor.Controls private readonly IEditorConfiguration _editorConfiguration; private readonly ToolTip _toolTip = new ToolTip(); private bool _updateInProgress; - private IList _recentColorButtons; public ColorDialog( IEditorConfiguration editorConfiguration, @@ -60,15 +59,16 @@ namespace Greenshot.Addon.LegacyEditor.Controls private void DrawButtons() { - int pos = FormDpiHandler.ScaleWithCurrentDpi(5); int size = FormDpiHandler.ScaleWithCurrentDpi(15); - var buttons = CreateColorPalette(pos, pos, size, size); - int lastColorY = FormDpiHandler.ScaleWithCurrentDpi(185); - _recentColorButtons = CreateLastUsedColorButtonRow(pos, lastColorY, size, size); - UpdateRecentColorsButtonRow(); + var buttons = CreateColorPalette(size, size); + var recentColorButtons = CreateLastUsedColorButtonRow(size, size); + SuspendLayout(); - Controls.AddRange(buttons.ToArray()); - Controls.AddRange(_recentColorButtons.ToArray()); + panelColors.Controls.Clear(); + panelColors.Controls.AddRange(buttons.ToArray()); + panelRecentColors.Controls.Clear(); + panelRecentColors.Controls.AddRange(recentColorButtons.ToArray()); + UpdateRecentColorsButtonRow(); ResumeLayout(); } @@ -103,9 +103,12 @@ namespace Greenshot.Addon.LegacyEditor.Controls #region user interface generation - private IList CreateColorPalette(int x, int y, int w, int h) + private IList CreateColorPalette(int w, int h) { - IList colorButtons = new List(); + int x = 0; + int y = 0; + + IList colorButtons = new List(); CreateColorButtonColumn(colorButtons, 255, 0, 0, x, y, w, h, 11); x += w; CreateColorButtonColumn(colorButtons, 255, 255 / 2, 0, x, y, w, h, 11); @@ -170,9 +173,12 @@ namespace Greenshot.Addon.LegacyEditor.Controls return b; } - private IList CreateLastUsedColorButtonRow(int x, int y, int w, int h) + private IList CreateLastUsedColorButtonRow(int w, int h) { - IList recentColorButtons = new List(); + int x = 0; + int y = 0; + + IList recentColorButtons = new List(); for (var i = 0; i < 12; i++) { @@ -193,8 +199,8 @@ namespace Greenshot.Addon.LegacyEditor.Controls { for (var i = 0; i < _editorConfiguration.RecentColors.Count && i < 12; i++) { - _recentColorButtons[i].BackColor = _editorConfiguration.RecentColors[i]; - _recentColorButtons[i].Enabled = true; + panelRecentColors.Controls[i].BackColor = _editorConfiguration.RecentColors[i]; + panelRecentColors.Controls[i].Enabled = true; } }