mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-02 18:26:27 +13:00
In color picker don't copy fields on double click
This commit is contained in:
parent
638aacf0b1
commit
e428ad0ebf
2 changed files with 14 additions and 38 deletions
|
@ -308,6 +308,8 @@ public static bool ParseColor(string text, out Color color)
|
||||||
{
|
{
|
||||||
text = text.Trim();
|
text = text.Trim();
|
||||||
|
|
||||||
|
if (text.Length <= 20)
|
||||||
|
{
|
||||||
Match matchHex = Regex.Match(text, @"^(?:#|0x)?((?:[0-9A-F]{2}){3})$", RegexOptions.IgnoreCase);
|
Match matchHex = Regex.Match(text, @"^(?:#|0x)?((?:[0-9A-F]{2}){3})$", RegexOptions.IgnoreCase);
|
||||||
|
|
||||||
if (matchHex.Success)
|
if (matchHex.Success)
|
||||||
|
@ -326,6 +328,7 @@ public static bool ParseColor(string text, out Color color)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
color = Color.Empty;
|
color = Color.Empty;
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -47,14 +47,6 @@ public ScreenColorPicker(bool checkClipboard = false)
|
||||||
|
|
||||||
UpdateControls(false);
|
UpdateControls(false);
|
||||||
|
|
||||||
foreach (Control control in Controls)
|
|
||||||
{
|
|
||||||
if (control is NumericUpDown || control is TextBox)
|
|
||||||
{
|
|
||||||
control.DoubleClick += CopyToClipboard;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (checkClipboard)
|
if (checkClipboard)
|
||||||
{
|
{
|
||||||
if (Clipboard.ContainsText())
|
if (Clipboard.ContainsText())
|
||||||
|
@ -69,25 +61,6 @@ public ScreenColorPicker(bool checkClipboard = false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CopyToClipboard(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
string text = "";
|
|
||||||
|
|
||||||
if (sender is NumericUpDown)
|
|
||||||
{
|
|
||||||
text = ((NumericUpDown)sender).Value.ToString();
|
|
||||||
}
|
|
||||||
else if (sender is TextBox)
|
|
||||||
{
|
|
||||||
text = ((TextBox)sender).Text;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(text))
|
|
||||||
{
|
|
||||||
ClipboardHelpers.CopyText(text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateColor(int x, int y)
|
private void UpdateColor(int x, int y)
|
||||||
{
|
{
|
||||||
UpdateColor(x, y, CaptureHelpers.GetPixelColor(x, y));
|
UpdateColor(x, y, CaptureHelpers.GetPixelColor(x, y));
|
||||||
|
|
Loading…
Reference in a new issue