fixed #3374: Added screen color picker support to image editor color picker, also gonna show recent colors in screen color picker tool too

This commit is contained in:
Jaex 2018-06-02 15:34:52 +03:00
parent c969eaf37f
commit ec45f15922
11 changed files with 1168 additions and 1120 deletions

View file

@ -68,7 +68,6 @@ private void InitializeComponent()
this.nudAlpha = new System.Windows.Forms.NumericUpDown();
this.lblAlpha = new System.Windows.Forms.Label();
this.ttMain = new System.Windows.Forms.ToolTip(this.components);
this.cbTransparent = new ShareX.HelpersLib.ColorButton();
this.cmsCopy = new System.Windows.Forms.ContextMenuStrip(this.components);
this.tsmiCopyAll = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiCopyRGB = new System.Windows.Forms.ToolStripMenuItem();
@ -77,20 +76,21 @@ private void InitializeComponent()
this.tsmiCopyHSB = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiCopyDecimal = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiCopyPosition = new System.Windows.Forms.ToolStripMenuItem();
this.pSceenColorPicker = new System.Windows.Forms.Panel();
this.btnPickColor = new System.Windows.Forms.Button();
this.pCursorPosition = new System.Windows.Forms.Panel();
this.txtY = new System.Windows.Forms.TextBox();
this.txtX = new System.Windows.Forms.TextBox();
this.lblY = new System.Windows.Forms.Label();
this.lblX = new System.Windows.Forms.Label();
this.lblCursorPosition = new System.Windows.Forms.Label();
this.btnClose = new System.Windows.Forms.Button();
this.mbCopy = new ShareX.HelpersLib.MenuButton();
this.pbColorPreview = new ShareX.HelpersLib.MyPictureBox();
this.colorPicker = new ShareX.HelpersLib.ColorPicker();
this.pColorPicker = new System.Windows.Forms.Panel();
this.pRecentColors = new System.Windows.Forms.Panel();
this.lblRecentColors = new System.Windows.Forms.Label();
this.flpRecentColors = new System.Windows.Forms.FlowLayoutPanel();
this.btnScreenColorPicker = new System.Windows.Forms.Button();
this.mbCopy = new ShareX.HelpersLib.MenuButton();
this.cbTransparent = new ShareX.HelpersLib.ColorButton();
this.pbColorPreview = new ShareX.HelpersLib.MyPictureBox();
this.colorPicker = new ShareX.HelpersLib.ColorPicker();
((System.ComponentModel.ISupportInitialize)(this.nudKey)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudYellow)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudMagenta)).BeginInit();
@ -103,8 +103,8 @@ private void InitializeComponent()
((System.ComponentModel.ISupportInitialize)(this.nudHue)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudAlpha)).BeginInit();
this.cmsCopy.SuspendLayout();
this.pSceenColorPicker.SuspendLayout();
this.pColorPicker.SuspendLayout();
this.pCursorPosition.SuspendLayout();
this.pRecentColors.SuspendLayout();
this.SuspendLayout();
//
// btnCancel
@ -414,16 +414,6 @@ private void InitializeComponent()
this.ttMain.InitialDelay = 100;
this.ttMain.ReshowDelay = 100;
//
// cbTransparent
//
this.cbTransparent.Color = System.Drawing.Color.Transparent;
resources.ApplyResources(this.cbTransparent, "cbTransparent");
this.cbTransparent.ManualButtonClick = true;
this.cbTransparent.Name = "cbTransparent";
this.ttMain.SetToolTip(this.cbTransparent, resources.GetString("cbTransparent.ToolTip"));
this.cbTransparent.UseVisualStyleBackColor = true;
this.cbTransparent.Click += new System.EventHandler(this.cbTransparent_Click);
//
// cmsCopy
//
this.cmsCopy.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -480,23 +470,15 @@ private void InitializeComponent()
resources.ApplyResources(this.tsmiCopyPosition, "tsmiCopyPosition");
this.tsmiCopyPosition.Click += new System.EventHandler(this.tsmiCopyPosition_Click);
//
// pSceenColorPicker
// pCursorPosition
//
this.pSceenColorPicker.Controls.Add(this.btnPickColor);
this.pSceenColorPicker.Controls.Add(this.txtY);
this.pSceenColorPicker.Controls.Add(this.txtX);
this.pSceenColorPicker.Controls.Add(this.lblY);
this.pSceenColorPicker.Controls.Add(this.lblX);
this.pSceenColorPicker.Controls.Add(this.lblCursorPosition);
resources.ApplyResources(this.pSceenColorPicker, "pSceenColorPicker");
this.pSceenColorPicker.Name = "pSceenColorPicker";
//
// btnPickColor
//
resources.ApplyResources(this.btnPickColor, "btnPickColor");
this.btnPickColor.Name = "btnPickColor";
this.btnPickColor.UseVisualStyleBackColor = true;
this.btnPickColor.Click += new System.EventHandler(this.btnPickColor_Click);
this.pCursorPosition.Controls.Add(this.txtY);
this.pCursorPosition.Controls.Add(this.txtX);
this.pCursorPosition.Controls.Add(this.lblY);
this.pCursorPosition.Controls.Add(this.lblX);
this.pCursorPosition.Controls.Add(this.lblCursorPosition);
resources.ApplyResources(this.pCursorPosition, "pCursorPosition");
this.pCursorPosition.Name = "pCursorPosition";
//
// txtY
//
@ -532,6 +514,32 @@ private void InitializeComponent()
this.btnClose.UseVisualStyleBackColor = true;
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
//
// pRecentColors
//
this.pRecentColors.Controls.Add(this.lblRecentColors);
this.pRecentColors.Controls.Add(this.flpRecentColors);
resources.ApplyResources(this.pRecentColors, "pRecentColors");
this.pRecentColors.Name = "pRecentColors";
//
// lblRecentColors
//
resources.ApplyResources(this.lblRecentColors, "lblRecentColors");
this.lblRecentColors.Name = "lblRecentColors";
//
// flpRecentColors
//
resources.ApplyResources(this.flpRecentColors, "flpRecentColors");
this.flpRecentColors.Name = "flpRecentColors";
//
// btnScreenColorPicker
//
this.btnScreenColorPicker.Image = global::ShareX.HelpersLib.Properties.Resources.pipette;
resources.ApplyResources(this.btnScreenColorPicker, "btnScreenColorPicker");
this.btnScreenColorPicker.Name = "btnScreenColorPicker";
this.ttMain.SetToolTip(this.btnScreenColorPicker, resources.GetString("btnScreenColorPicker.ToolTip"));
this.btnScreenColorPicker.UseVisualStyleBackColor = true;
this.btnScreenColorPicker.Click += new System.EventHandler(this.btnScreenColorPicker_Click);
//
// mbCopy
//
resources.ApplyResources(this.mbCopy, "mbCopy");
@ -539,6 +547,16 @@ private void InitializeComponent()
this.mbCopy.Name = "mbCopy";
this.mbCopy.UseVisualStyleBackColor = true;
//
// cbTransparent
//
this.cbTransparent.Color = System.Drawing.Color.Transparent;
resources.ApplyResources(this.cbTransparent, "cbTransparent");
this.cbTransparent.ManualButtonClick = true;
this.cbTransparent.Name = "cbTransparent";
this.ttMain.SetToolTip(this.cbTransparent, resources.GetString("cbTransparent.ToolTip"));
this.cbTransparent.UseVisualStyleBackColor = true;
this.cbTransparent.Click += new System.EventHandler(this.cbTransparent_Click);
//
// pbColorPreview
//
this.pbColorPreview.BackColor = System.Drawing.SystemColors.Window;
@ -555,32 +573,15 @@ private void InitializeComponent()
this.colorPicker.Name = "colorPicker";
this.colorPicker.ColorChanged += new ShareX.HelpersLib.ColorEventHandler(this.colorPicker_ColorChanged);
//
// pColorPicker
//
this.pColorPicker.Controls.Add(this.lblRecentColors);
this.pColorPicker.Controls.Add(this.flpRecentColors);
resources.ApplyResources(this.pColorPicker, "pColorPicker");
this.pColorPicker.Name = "pColorPicker";
//
// lblRecentColors
//
resources.ApplyResources(this.lblRecentColors, "lblRecentColors");
this.lblRecentColors.Name = "lblRecentColors";
//
// flpRecentColors
//
resources.ApplyResources(this.flpRecentColors, "flpRecentColors");
this.flpRecentColors.Name = "flpRecentColors";
//
// ColorPickerForm
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Window;
this.CancelButton = this.btnCancel;
this.Controls.Add(this.pColorPicker);
this.Controls.Add(this.btnScreenColorPicker);
this.Controls.Add(this.btnClose);
this.Controls.Add(this.pSceenColorPicker);
this.Controls.Add(this.pCursorPosition);
this.Controls.Add(this.mbCopy);
this.Controls.Add(this.cbTransparent);
this.Controls.Add(this.nudBlue);
@ -622,6 +623,7 @@ private void InitializeComponent()
this.Controls.Add(this.rbBrightness);
this.Controls.Add(this.rbSaturation);
this.Controls.Add(this.rbHue);
this.Controls.Add(this.pRecentColors);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.Name = "ColorPickerForm";
@ -639,10 +641,10 @@ private void InitializeComponent()
((System.ComponentModel.ISupportInitialize)(this.nudHue)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nudAlpha)).EndInit();
this.cmsCopy.ResumeLayout(false);
this.pSceenColorPicker.ResumeLayout(false);
this.pSceenColorPicker.PerformLayout();
this.pColorPicker.ResumeLayout(false);
this.pColorPicker.PerformLayout();
this.pCursorPosition.ResumeLayout(false);
this.pCursorPosition.PerformLayout();
this.pRecentColors.ResumeLayout(false);
this.pRecentColors.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@ -700,16 +702,16 @@ private void InitializeComponent()
private System.Windows.Forms.ToolStripMenuItem tsmiCopyHSB;
private System.Windows.Forms.ToolStripMenuItem tsmiCopyDecimal;
private System.Windows.Forms.ToolStripMenuItem tsmiCopyPosition;
private System.Windows.Forms.Panel pSceenColorPicker;
private System.Windows.Forms.Panel pCursorPosition;
private System.Windows.Forms.Label lblCursorPosition;
private System.Windows.Forms.Label lblX;
private System.Windows.Forms.Label lblY;
private System.Windows.Forms.TextBox txtX;
private System.Windows.Forms.TextBox txtY;
private System.Windows.Forms.Button btnClose;
private System.Windows.Forms.Button btnPickColor;
private System.Windows.Forms.Panel pColorPicker;
private System.Windows.Forms.Panel pRecentColors;
private System.Windows.Forms.FlowLayoutPanel flpRecentColors;
private System.Windows.Forms.Label lblRecentColors;
private System.Windows.Forms.Button btnScreenColorPicker;
}
}

View file

@ -48,27 +48,28 @@ public ColorPickerForm(Color currentColor, bool isScreenColorPickerMode = false)
IsScreenColorPickerMode = isScreenColorPickerMode;
PrepareRecentColors();
SetCurrentColor(currentColor, !IsScreenColorPickerMode);
btnOK.Visible = btnCancel.Visible = pColorPicker.Visible = !IsScreenColorPickerMode;
mbCopy.Visible = btnClose.Visible = pSceenColorPicker.Visible = IsScreenColorPickerMode;
if (!IsScreenColorPickerMode)
{
PrepareRecentColors();
}
btnOK.Visible = btnCancel.Visible = !IsScreenColorPickerMode;
mbCopy.Visible = btnClose.Visible = pCursorPosition.Visible = IsScreenColorPickerMode;
}
public void EnableScreenColorPickerButton(Func<PointInfo> openScreenColorPicker)
{
OpenScreenColorPicker = openScreenColorPicker;
btnPickColor.Visible = true;
btnScreenColorPicker.Visible = true;
}
public static bool PickColor(Color currentColor, out Color newColor, Form owner = null)
public static bool PickColor(Color currentColor, out Color newColor, Form owner = null, Func<PointInfo> openScreenColorPicker = null)
{
using (ColorPickerForm dialog = new ColorPickerForm(currentColor))
{
if (openScreenColorPicker != null)
{
dialog.EnableScreenColorPickerButton(openScreenColorPicker);
}
if (dialog.ShowDialog(owner) == DialogResult.OK)
{
newColor = dialog.NewColor;
@ -385,7 +386,7 @@ private void tsmiCopyPosition_Click(object sender, EventArgs e)
ClipboardHelpers.CopyText($"{txtX.Text}, {txtY.Text}");
}
private void btnPickColor_Click(object sender, EventArgs e)
private void btnScreenColorPicker_Click(object sender, EventArgs e)
{
try
{

View file

@ -123,10 +123,10 @@
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="btnCancel.Location" type="System.Drawing.Point, System.Drawing">
<value>582, 288</value>
<value>576, 288</value>
</data>
<data name="btnCancel.Size" type="System.Drawing.Size, System.Drawing">
<value>94, 32</value>
<value>96, 32</value>
</data>
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="btnCancel.TabIndex" type="System.Int32, mscorlib">
@ -151,10 +151,10 @@
<value>NoControl</value>
</data>
<data name="btnOK.Location" type="System.Drawing.Point, System.Drawing">
<value>480, 288</value>
<value>472, 288</value>
</data>
<data name="btnOK.Size" type="System.Drawing.Size, System.Drawing">
<value>94, 32</value>
<value>96, 32</value>
</data>
<data name="btnOK.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
@ -235,7 +235,7 @@
<value>25</value>
</data>
<data name="txtHex.Location" type="System.Drawing.Point, System.Drawing">
<value>604, 174</value>
<value>600, 174</value>
</data>
<data name="txtHex.MaxLength" type="System.Int32, mscorlib">
<value>9</value>
@ -295,7 +295,7 @@
<value>27</value>
</data>
<data name="nudKey.Location" type="System.Drawing.Point, System.Drawing">
<value>604, 142</value>
<value>600, 142</value>
</data>
<data name="nudKey.Size" type="System.Drawing.Size, System.Drawing">
<value>56, 20</value>
@ -319,7 +319,7 @@
<value>28</value>
</data>
<data name="nudYellow.Location" type="System.Drawing.Point, System.Drawing">
<value>604, 108</value>
<value>600, 108</value>
</data>
<data name="nudYellow.Size" type="System.Drawing.Size, System.Drawing">
<value>56, 20</value>
@ -343,7 +343,7 @@
<value>29</value>
</data>
<data name="nudMagenta.Location" type="System.Drawing.Point, System.Drawing">
<value>604, 78</value>
<value>600, 78</value>
</data>
<data name="nudMagenta.Size" type="System.Drawing.Size, System.Drawing">
<value>56, 20</value>
@ -367,7 +367,7 @@
<value>30</value>
</data>
<data name="nudCyan.Location" type="System.Drawing.Point, System.Drawing">
<value>604, 46</value>
<value>600, 46</value>
</data>
<data name="nudCyan.Size" type="System.Drawing.Size, System.Drawing">
<value>56, 20</value>
@ -964,7 +964,7 @@
<value>20</value>
</data>
<data name="txtDecimal.Location" type="System.Drawing.Point, System.Drawing">
<value>604, 204</value>
<value>600, 204</value>
</data>
<data name="txtDecimal.Size" type="System.Drawing.Size, System.Drawing">
<value>72, 20</value>
@ -1000,7 +1000,7 @@
<value>NoControl</value>
</data>
<data name="lblCyanPerc.Location" type="System.Drawing.Point, System.Drawing">
<value>662, 50</value>
<value>658, 50</value>
</data>
<data name="lblCyanPerc.Size" type="System.Drawing.Size, System.Drawing">
<value>19, 13</value>
@ -1033,7 +1033,7 @@
<value>NoControl</value>
</data>
<data name="lblMagentaPerc.Location" type="System.Drawing.Point, System.Drawing">
<value>662, 82</value>
<value>658, 82</value>
</data>
<data name="lblMagentaPerc.Size" type="System.Drawing.Size, System.Drawing">
<value>19, 13</value>
@ -1066,7 +1066,7 @@
<value>NoControl</value>
</data>
<data name="lblYellowPerc.Location" type="System.Drawing.Point, System.Drawing">
<value>662, 112</value>
<value>658, 112</value>
</data>
<data name="lblYellowPerc.Size" type="System.Drawing.Size, System.Drawing">
<value>19, 13</value>
@ -1099,7 +1099,7 @@
<value>NoControl</value>
</data>
<data name="lblKeyPerc.Location" type="System.Drawing.Point, System.Drawing">
<value>662, 146</value>
<value>658, 146</value>
</data>
<data name="lblKeyPerc.Size" type="System.Drawing.Size, System.Drawing">
<value>19, 13</value>
@ -1123,7 +1123,7 @@
<value>15</value>
</data>
<data name="nudAlpha.Location" type="System.Drawing.Point, System.Drawing">
<value>604, 14</value>
<value>600, 14</value>
</data>
<data name="nudAlpha.Size" type="System.Drawing.Size, System.Drawing">
<value>48, 20</value>
@ -1233,35 +1233,8 @@
<data name="&gt;&gt;cmsCopy.Type" xml:space="preserve">
<value>System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="btnPickColor.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="btnPickColor.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
<data name="btnPickColor.Size" type="System.Drawing.Size, System.Drawing">
<value>289, 24</value>
</data>
<data name="btnPickColor.TabIndex" type="System.Int32, mscorlib">
<value>44</value>
</data>
<data name="btnPickColor.Text" xml:space="preserve">
<value>Pick color from screen...</value>
</data>
<data name="&gt;&gt;btnPickColor.Name" xml:space="preserve">
<value>btnPickColor</value>
</data>
<data name="&gt;&gt;btnPickColor.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;btnPickColor.Parent" xml:space="preserve">
<value>pSceenColorPicker</value>
</data>
<data name="&gt;&gt;btnPickColor.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="txtY.Location" type="System.Drawing.Point, System.Drawing">
<value>240, 28</value>
<value>136, 24</value>
</data>
<data name="txtY.Size" type="System.Drawing.Size, System.Drawing">
<value>48, 20</value>
@ -1282,13 +1255,13 @@
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;txtY.Parent" xml:space="preserve">
<value>pSceenColorPicker</value>
<value>pCursorPosition</value>
</data>
<data name="&gt;&gt;txtY.ZOrder" xml:space="preserve">
<value>1</value>
<value>0</value>
</data>
<data name="txtX.Location" type="System.Drawing.Point, System.Drawing">
<value>168, 28</value>
<value>136, 0</value>
</data>
<data name="txtX.Size" type="System.Drawing.Size, System.Drawing">
<value>48, 20</value>
@ -1309,10 +1282,10 @@
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;txtX.Parent" xml:space="preserve">
<value>pSceenColorPicker</value>
<value>pCursorPosition</value>
</data>
<data name="&gt;&gt;txtX.ZOrder" xml:space="preserve">
<value>2</value>
<value>1</value>
</data>
<data name="lblY.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -1321,7 +1294,7 @@
<value>NoControl</value>
</data>
<data name="lblY.Location" type="System.Drawing.Point, System.Drawing">
<value>222, 32</value>
<value>112, 28</value>
</data>
<data name="lblY.Size" type="System.Drawing.Size, System.Drawing">
<value>17, 13</value>
@ -1339,10 +1312,10 @@
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;lblY.Parent" xml:space="preserve">
<value>pSceenColorPicker</value>
<value>pCursorPosition</value>
</data>
<data name="&gt;&gt;lblY.ZOrder" xml:space="preserve">
<value>3</value>
<value>2</value>
</data>
<data name="lblX.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -1351,7 +1324,7 @@
<value>NoControl</value>
</data>
<data name="lblX.Location" type="System.Drawing.Point, System.Drawing">
<value>150, 32</value>
<value>112, 4</value>
</data>
<data name="lblX.Size" type="System.Drawing.Size, System.Drawing">
<value>17, 13</value>
@ -1369,10 +1342,10 @@
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;lblX.Parent" xml:space="preserve">
<value>pSceenColorPicker</value>
<value>pCursorPosition</value>
</data>
<data name="&gt;&gt;lblX.ZOrder" xml:space="preserve">
<value>4</value>
<value>3</value>
</data>
<data name="lblCursorPosition.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -1381,7 +1354,7 @@
<value>NoControl</value>
</data>
<data name="lblCursorPosition.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 32</value>
<value>0, 4</value>
</data>
<data name="lblCursorPosition.Size" type="System.Drawing.Size, System.Drawing">
<value>79, 13</value>
@ -1399,40 +1372,40 @@
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;lblCursorPosition.Parent" xml:space="preserve">
<value>pSceenColorPicker</value>
<value>pCursorPosition</value>
</data>
<data name="&gt;&gt;lblCursorPosition.ZOrder" xml:space="preserve">
<value>5</value>
<value>4</value>
</data>
<data name="pSceenColorPicker.Location" type="System.Drawing.Point, System.Drawing">
<value>8, 272</value>
<data name="pCursorPosition.Location" type="System.Drawing.Point, System.Drawing">
<value>488, 232</value>
</data>
<data name="pSceenColorPicker.Size" type="System.Drawing.Size, System.Drawing">
<value>296, 56</value>
<data name="pCursorPosition.Size" type="System.Drawing.Size, System.Drawing">
<value>192, 48</value>
</data>
<data name="pSceenColorPicker.TabIndex" type="System.Int32, mscorlib">
<data name="pCursorPosition.TabIndex" type="System.Int32, mscorlib">
<value>42</value>
</data>
<data name="&gt;&gt;pSceenColorPicker.Name" xml:space="preserve">
<value>pSceenColorPicker</value>
<data name="&gt;&gt;pCursorPosition.Name" xml:space="preserve">
<value>pCursorPosition</value>
</data>
<data name="&gt;&gt;pSceenColorPicker.Type" xml:space="preserve">
<data name="&gt;&gt;pCursorPosition.Type" xml:space="preserve">
<value>System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;pSceenColorPicker.Parent" xml:space="preserve">
<data name="&gt;&gt;pCursorPosition.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;pSceenColorPicker.ZOrder" xml:space="preserve">
<data name="&gt;&gt;pCursorPosition.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="btnClose.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="btnClose.Location" type="System.Drawing.Point, System.Drawing">
<value>582, 288</value>
<value>576, 288</value>
</data>
<data name="btnClose.Size" type="System.Drawing.Size, System.Drawing">
<value>94, 32</value>
<value>96, 32</value>
</data>
<data name="btnClose.TabIndex" type="System.Int32, mscorlib">
<value>43</value>
@ -1477,7 +1450,7 @@
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;lblRecentColors.Parent" xml:space="preserve">
<value>pColorPicker</value>
<value>pRecentColors</value>
</data>
<data name="&gt;&gt;lblRecentColors.ZOrder" xml:space="preserve">
<value>0</value>
@ -1498,30 +1471,60 @@
<value>System.Windows.Forms.FlowLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;flpRecentColors.Parent" xml:space="preserve">
<value>pColorPicker</value>
<value>pRecentColors</value>
</data>
<data name="&gt;&gt;flpRecentColors.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="pColorPicker.Location" type="System.Drawing.Point, System.Drawing">
<data name="pRecentColors.Location" type="System.Drawing.Point, System.Drawing">
<value>8, 271</value>
</data>
<data name="pColorPicker.Size" type="System.Drawing.Size, System.Drawing">
<data name="pRecentColors.Size" type="System.Drawing.Size, System.Drawing">
<value>296, 56</value>
</data>
<data name="pColorPicker.TabIndex" type="System.Int32, mscorlib">
<data name="pRecentColors.TabIndex" type="System.Int32, mscorlib">
<value>44</value>
</data>
<data name="&gt;&gt;pColorPicker.Name" xml:space="preserve">
<value>pColorPicker</value>
<data name="&gt;&gt;pRecentColors.Name" xml:space="preserve">
<value>pRecentColors</value>
</data>
<data name="&gt;&gt;pColorPicker.Type" xml:space="preserve">
<data name="&gt;&gt;pRecentColors.Type" xml:space="preserve">
<value>System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;pColorPicker.Parent" xml:space="preserve">
<data name="&gt;&gt;pRecentColors.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;pColorPicker.ZOrder" xml:space="preserve">
<data name="&gt;&gt;pRecentColors.ZOrder" xml:space="preserve">
<value>45</value>
</data>
<data name="btnScreenColorPicker.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="btnScreenColorPicker.Location" type="System.Drawing.Point, System.Drawing">
<value>432, 288</value>
</data>
<data name="btnScreenColorPicker.Size" type="System.Drawing.Size, System.Drawing">
<value>32, 32</value>
</data>
<data name="btnScreenColorPicker.TabIndex" type="System.Int32, mscorlib">
<value>45</value>
</data>
<data name="btnScreenColorPicker.ToolTip" xml:space="preserve">
<value>Pick color from screen</value>
</data>
<data name="btnScreenColorPicker.Visible" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="&gt;&gt;btnScreenColorPicker.Name" xml:space="preserve">
<value>btnScreenColorPicker</value>
</data>
<data name="&gt;&gt;btnScreenColorPicker.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;btnScreenColorPicker.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;btnScreenColorPicker.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="mbCopy.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
@ -1531,7 +1534,7 @@
<value>472, 288</value>
</data>
<data name="mbCopy.Size" type="System.Drawing.Size, System.Drawing">
<value>102, 32</value>
<value>96, 32</value>
</data>
<data name="mbCopy.TabIndex" type="System.Int32, mscorlib">
<value>40</value>
@ -1555,7 +1558,7 @@
<value>NoControl</value>
</data>
<data name="cbTransparent.Location" type="System.Drawing.Point, System.Drawing">
<value>656, 13</value>
<value>652, 13</value>
</data>
<data name="cbTransparent.Size" type="System.Drawing.Size, System.Drawing">
<value>23, 23</value>
@ -1630,7 +1633,7 @@
<value>6, 13</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>684, 328</value>
<value>681, 328</value>
</data>
<data name="$this.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>

View file

@ -137,7 +137,15 @@ internal static string ActionsCodeMenuEntry_OutputFilePath_File_path_without_ext
///easygoing
///ecstatic
///edible
///educat [rest of string was truncated]&quot;;.
///educated
///fabulous
///failing
///faint
///fair
///faithful
///fake
///familiar
///fam [rest of string was truncated]&quot;;.
/// </summary>
internal static string adjectives {
get {
@ -413,7 +421,8 @@ internal static string AmazonS3StorageClass_STANDARD_IA {
///africanjacana
///africanmolesnake
///africanparadiseflycatcher
///a [rest of string was truncated]&quot;;.
///africanpiedkingfisher
///africanporcu [rest of string was truncated]&quot;;.
/// </summary>
internal static string animals {
get {
@ -2266,6 +2275,16 @@ internal static string PastebinPrivacy_Unlisted {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap pipette {
get {
object obj = ResourceManager.GetObject("pipette", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized string similar to Automatically detect.
/// </summary>

File diff suppressed because it is too large Load diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 543 B

View file

@ -1313,6 +1313,9 @@
<Version>11.0.2</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<None Include="Resources\pipette.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View file

@ -128,6 +128,25 @@ public static SimpleWindowInfo GetWindowInfo(RegionCaptureOptions options)
return null;
}
public static void ShowScreenColorPickerDialog(RegionCaptureOptions options, bool checkClipboard = true)
{
Color color = Color.Red;
if (checkClipboard && Clipboard.ContainsText())
{
string text = Clipboard.GetText();
if (ColorHelpers.ParseColor(text, out Color clipboardColor))
{
color = clipboardColor;
}
}
ColorPickerForm colorPickerForm = new ColorPickerForm(color, true);
colorPickerForm.EnableScreenColorPickerButton(() => GetPointInfo(options));
colorPickerForm.Show();
}
public static void ShowScreenRuler(RegionCaptureOptions options)
{
RegionCaptureOptions newOptions = GetRegionCaptureOptions(options);

View file

@ -1857,6 +1857,18 @@ private void AddImageEffects()
Form.Resume();
}
private bool PickColor(Color currentColor, out Color newColor)
{
Func<PointInfo> openScreenColorPicker = null;
if (!Form.IsFullscreen)
{
openScreenColorPicker = () => RegionCaptureTasks.GetPointInfo(Options);
}
return ColorPickerForm.PickColor(currentColor, out newColor, Form, openScreenColorPicker);
}
private void OnCurrentShapeChanged(BaseShape shape)
{
if (CurrentShapeChanged != null)

View file

@ -323,7 +323,7 @@ internal void CreateToolbar()
borderColor = AnnotationOptions.BorderColor;
}
if (ColorPickerForm.PickColor(borderColor, out Color newColor, Form))
if (PickColor(borderColor, out Color newColor))
{
if (shapeType == ShapeType.DrawingTextBackground || shapeType == ShapeType.DrawingSpeechBalloon)
{
@ -373,7 +373,7 @@ internal void CreateToolbar()
fillColor = AnnotationOptions.FillColor;
}
if (ColorPickerForm.PickColor(fillColor, out Color newColor, Form))
if (PickColor(fillColor, out Color newColor))
{
if (shapeType == ShapeType.DrawingTextBackground || shapeType == ShapeType.DrawingSpeechBalloon)
{
@ -402,7 +402,7 @@ internal void CreateToolbar()
{
Form.Pause();
if (ColorPickerForm.PickColor(AnnotationOptions.HighlightColor, out Color newColor, Form))
if (PickColor(AnnotationOptions.HighlightColor, out Color newColor))
{
AnnotationOptions.HighlightColor = newColor;
UpdateMenu();
@ -564,7 +564,7 @@ internal void CreateToolbar()
{
Form.Pause();
if (ColorPickerForm.PickColor(AnnotationOptions.ShadowColor, out Color newColor, Form))
if (PickColor(AnnotationOptions.ShadowColor, out Color newColor))
{
AnnotationOptions.ShadowColor = newColor;
UpdateMenu();
@ -823,7 +823,7 @@ internal void CreateToolbar()
{
Form.Pause();
if (ColorPickerForm.PickColor(Options.ImageEditorBackgroundColor, out Color newColor, Form))
if (PickColor(Options.ImageEditorBackgroundColor, out Color newColor))
{
Options.ImageEditorBackgroundColor = newColor;
UpdateMenu();

View file

@ -729,25 +729,11 @@ private static void imageHistoryForm_FormClosed(object sender, FormClosedEventAr
Program.Settings.ImageHistoryMaxItemCount = imageHistoryForm.MaxItemCount;
}
public static void ShowScreenColorPickerDialog(TaskSettings taskSettings = null, bool checkClipboard = true)
public static void ShowScreenColorPickerDialog(TaskSettings taskSettings = null)
{
if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
Color color = Color.Red;
if (checkClipboard && Clipboard.ContainsText())
{
string text = Clipboard.GetText();
if (ColorHelpers.ParseColor(text, out Color clipboardColor))
{
color = clipboardColor;
}
}
ColorPickerForm colorPickerForm = new ColorPickerForm(color, true);
colorPickerForm.EnableScreenColorPickerButton(() => RegionCaptureTasks.GetPointInfo(taskSettings.CaptureSettings.SurfaceOptions));
colorPickerForm.Show();
RegionCaptureTasks.ShowScreenColorPickerDialog(taskSettings.CaptureSettings.SurfaceOptions, true);
}
public static void OpenScreenColorPicker(TaskSettings taskSettings = null)