diff --git a/mRemoteNG/UI/Controls/Base/NGTextBox.cs b/mRemoteNG/UI/Controls/Base/NGTextBox.cs index e50fd8fac..479637d6b 100644 --- a/mRemoteNG/UI/Controls/Base/NGTextBox.cs +++ b/mRemoteNG/UI/Controls/Base/NGTextBox.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; using System.Drawing; using System.Windows.Forms; using mRemoteNG.Themes; diff --git a/mRemoteNG/UI/Forms/FrmPassword.Designer.cs b/mRemoteNG/UI/Forms/FrmPassword.Designer.cs index 94b6055be..c9e8bc7c3 100644 --- a/mRemoteNG/UI/Forms/FrmPassword.Designer.cs +++ b/mRemoteNG/UI/Forms/FrmPassword.Designer.cs @@ -1,6 +1,4 @@ -using TextBox = mRemoteNG.UI.Forms.TextBox; - -namespace mRemoteNG.UI.Forms +namespace mRemoteNG.UI.Forms { public partial class FrmPassword : System.Windows.Forms.Form @@ -42,8 +40,8 @@ namespace mRemoteNG.UI.Forms this.btnCancel = new mRemoteNG.UI.Controls.Base.NGButton(); this.lblStatus = new mRemoteNG.UI.Controls.Base.NGLabel(); this.pbLock = new System.Windows.Forms.PictureBox(); - this.txtVerify = new mRemoteNG.UI.Forms.TextBox(); - this.txtPassword = new mRemoteNG.UI.Forms.TextBox(); + this.txtVerify = new mRemoteNG.UI.Controls.Base.NGTextBox(); + this.txtPassword = new mRemoteNG.UI.Controls.Base.NGTextBox(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); ((System.ComponentModel.ISupportInitialize)(this.pbLock)).BeginInit(); this.tableLayoutPanel1.SuspendLayout(); @@ -124,7 +122,6 @@ namespace mRemoteNG.UI.Forms this.tableLayoutPanel1.SetColumnSpan(this.txtVerify, 2); this.txtVerify.Location = new System.Drawing.Point(73, 66); this.txtVerify.Name = "txtVerify"; - this.txtVerify.SelectAllOnFocus = true; this.txtVerify.Size = new System.Drawing.Size(298, 22); this.txtVerify.TabIndex = 4; this.txtVerify.UseSystemPasswordChar = true; @@ -137,7 +134,6 @@ namespace mRemoteNG.UI.Forms this.tableLayoutPanel1.SetColumnSpan(this.txtPassword, 2); this.txtPassword.Location = new System.Drawing.Point(73, 25); this.txtPassword.Name = "txtPassword"; - this.txtPassword.SelectAllOnFocus = true; this.txtPassword.Size = new System.Drawing.Size(298, 22); this.txtPassword.TabIndex = 2; this.txtPassword.UseSystemPasswordChar = true; @@ -197,8 +193,8 @@ namespace mRemoteNG.UI.Forms this.ResumeLayout(false); } - private TextBox txtPassword; - private TextBox txtVerify; + private Controls.Base.NGTextBox txtPassword; + private Controls.Base.NGTextBox txtVerify; private Controls.Base.NGLabel lblPassword; private Controls.Base.NGLabel lblVerify; private Controls.Base.NGButton btnOK; diff --git a/mRemoteNG/UI/Forms/TextBox.cs b/mRemoteNG/UI/Forms/TextBox.cs deleted file mode 100644 index 1b7329faa..000000000 --- a/mRemoteNG/UI/Forms/TextBox.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System; -using System.ComponentModel; -using System.Windows.Forms; - -// Adapted from http://stackoverflow.com/a/3678888/2101395 - -namespace mRemoteNG.UI.Forms -{ - public class TextBox : Controls.Base.NGTextBox - { - #region Public Properties - - [Category("Behavior"), - DefaultValue(false)] - private bool _SelectAllOnFocus; - - public bool SelectAllOnFocus - { - get => _SelectAllOnFocus; - set => _SelectAllOnFocus = value; - } - - #endregion - - #region Protected Methods - - protected override void OnEnter(EventArgs e) - { - base.OnEnter(e); - - if (MouseButtons != MouseButtons.None) return; - SelectAll(); - _focusHandled = true; - } - - protected override void OnLeave(EventArgs e) - { - base.OnLeave(e); - - _focusHandled = false; - } - - protected override void OnMouseUp(MouseEventArgs e) - { - base.OnMouseUp(e); - - if (_focusHandled) return; - if (SelectionLength == 0) - { - SelectAll(); - } - - _focusHandled = true; - } - - #endregion - - #region Private Fields - - private bool _focusHandled; - - #endregion - - private void InitializeComponent() - { - this.SuspendLayout(); - // - // TextBox - // - this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, - System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.ResumeLayout(false); - } - } -} \ No newline at end of file diff --git a/mRemoteNG/UI/Forms/TextBox.resx b/mRemoteNG/UI/Forms/TextBox.resx deleted file mode 100644 index e5858cc29..000000000 --- a/mRemoteNG/UI/Forms/TextBox.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - False - - \ No newline at end of file diff --git a/mRemoteNG/UI/Forms/frmMain.cs b/mRemoteNG/UI/Forms/frmMain.cs index e19b3d44f..cd9719a53 100644 --- a/mRemoteNG/UI/Forms/frmMain.cs +++ b/mRemoteNG/UI/Forms/frmMain.cs @@ -32,6 +32,7 @@ using CefSharp; using CefSharp.WinForms; using CefSharp.SchemeHandler; using mRemoteNG.Resources.Language; +using mRemoteNG.UI.Controls.Base; using Settings = mRemoteNG.Properties.Settings; // ReSharper disable MemberCanBePrivate.Global @@ -550,7 +551,7 @@ namespace mRemoteNG.UI.Forms { if (controlThatWasClicked is TreeView || controlThatWasClicked is ComboBox || - controlThatWasClicked is TextBox || + controlThatWasClicked is NGTextBox || controlThatWasClicked is FrmMain) { controlThatWasClicked.Focus(); diff --git a/mRemoteNG/mRemoteNG.csproj b/mRemoteNG/mRemoteNG.csproj index d1c2109d6..4e93b9560 100644 --- a/mRemoteNG/mRemoteNG.csproj +++ b/mRemoteNG/mRemoteNG.csproj @@ -649,9 +649,6 @@ - - Component - Form @@ -995,9 +992,6 @@ ReconnectGroup.cs Designer - - TextBox.cs - FrmUnhandledException.cs