In color picker don't copy fields on double click

This commit is contained in:
Jaex 2017-05-17 15:44:25 +03:00
parent 638aacf0b1
commit e428ad0ebf
2 changed files with 14 additions and 38 deletions

View file

@ -308,6 +308,8 @@ public static bool ParseColor(string text, out Color color)
{
text = text.Trim();
if (text.Length <= 20)
{
Match matchHex = Regex.Match(text, @"^(?:#|0x)?((?:[0-9A-F]{2}){3})$", RegexOptions.IgnoreCase);
if (matchHex.Success)
@ -326,6 +328,7 @@ public static bool ParseColor(string text, out Color color)
}
}
}
}
color = Color.Empty;
return false;

View file

@ -47,14 +47,6 @@ public ScreenColorPicker(bool checkClipboard = false)
UpdateControls(false);
foreach (Control control in Controls)
{
if (control is NumericUpDown || control is TextBox)
{
control.DoubleClick += CopyToClipboard;
}
}
if (checkClipboard)
{
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)
{
UpdateColor(x, y, CaptureHelpers.GetPixelColor(x, y));