From cc68931c00a8c064135da6bfd17a3dfdfb64d33e Mon Sep 17 00:00:00 2001 From: Jaex Date: Mon, 18 May 2015 09:22:40 +0300 Subject: [PATCH] fixed #696: Label auto copy bug workaround --- .../Controls/BlackStyle/BlackStyleLabel.cs | 2 + ShareX.HelpersLib/Controls/LabelNoCopy.cs | 57 +++++++++++++++++++ ShareX.HelpersLib/ShareX.HelpersLib.csproj | 3 + .../HotkeySelectionControl.Designer.cs | 4 +- 4 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 ShareX.HelpersLib/Controls/LabelNoCopy.cs diff --git a/ShareX.HelpersLib/Controls/BlackStyle/BlackStyleLabel.cs b/ShareX.HelpersLib/Controls/BlackStyle/BlackStyleLabel.cs index 2164b9975..ecf2d7867 100644 --- a/ShareX.HelpersLib/Controls/BlackStyle/BlackStyleLabel.cs +++ b/ShareX.HelpersLib/Controls/BlackStyle/BlackStyleLabel.cs @@ -23,6 +23,7 @@ #endregion License Information (GPL v3) +using System; using System.ComponentModel; using System.Drawing; using System.Drawing.Design; @@ -53,6 +54,7 @@ public override string Text { text = value; Refresh(); + OnTextChanged(EventArgs.Empty); } } } diff --git a/ShareX.HelpersLib/Controls/LabelNoCopy.cs b/ShareX.HelpersLib/Controls/LabelNoCopy.cs new file mode 100644 index 000000000..b55ba9ba0 --- /dev/null +++ b/ShareX.HelpersLib/Controls/LabelNoCopy.cs @@ -0,0 +1,57 @@ +#region License Information (GPL v3) + +/* + ShareX - A program that allows you to take screenshots and share any file type + Copyright © 2007-2015 ShareX Developers + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Optionally you can also view the license at . +*/ + +#endregion License Information (GPL v3) + +using System; +using System.Windows.Forms; + +namespace ShareX.HelpersLib +{ + public class LabelNoCopy : Label + { + private string text; + + public override string Text + { + get + { + return text; + } + set + { + if (value == null) + { + value = ""; + } + + if (text != value) + { + text = value; + Refresh(); + OnTextChanged(EventArgs.Empty); + } + } + } + } +} \ No newline at end of file diff --git a/ShareX.HelpersLib/ShareX.HelpersLib.csproj b/ShareX.HelpersLib/ShareX.HelpersLib.csproj index bcc2217df..7c459f5d6 100644 --- a/ShareX.HelpersLib/ShareX.HelpersLib.csproj +++ b/ShareX.HelpersLib/ShareX.HelpersLib.csproj @@ -102,6 +102,9 @@ + + Component + Component diff --git a/ShareX/Controls/HotkeySelectionControl.Designer.cs b/ShareX/Controls/HotkeySelectionControl.Designer.cs index 82e6f4405..b78539811 100644 --- a/ShareX/Controls/HotkeySelectionControl.Designer.cs +++ b/ShareX/Controls/HotkeySelectionControl.Designer.cs @@ -30,7 +30,7 @@ private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HotkeySelectionControl)); this.lblHotkeyStatus = new System.Windows.Forms.Label(); - this.lblHotkeyDescription = new System.Windows.Forms.Label(); + this.lblHotkeyDescription = new ShareX.HelpersLib.LabelNoCopy(); this.btnHotkey = new System.Windows.Forms.Button(); this.SuspendLayout(); // @@ -79,7 +79,7 @@ private void InitializeComponent() #endregion private System.Windows.Forms.Label lblHotkeyStatus; - private System.Windows.Forms.Label lblHotkeyDescription; + private ShareX.HelpersLib.LabelNoCopy lblHotkeyDescription; private System.Windows.Forms.Button btnHotkey; } }