Removed TextBox class and using NGTextBox instead

This commit is contained in:
Faryan Rezagholi
2020-06-13 13:43:48 +02:00
parent 97bd0a11f3
commit 40a4291b07
6 changed files with 8 additions and 214 deletions

View File

@@ -1,4 +1,5 @@
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using mRemoteNG.Themes;

View File

@@ -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;

View File

@@ -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);
}
}
}

View File

@@ -1,123 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>

View File

@@ -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();

View File

@@ -649,9 +649,6 @@
<Compile Include="Tools\PortScanner.cs" />
<Compile Include="Tools\WindowMenu.cs" />
<Compile Include="Tools\Tools.WindowPlacement.cs" />
<Compile Include="UI\Forms\TextBox.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="UI\Forms\FrmUnhandledException.cs">
<SubType>Form</SubType>
</Compile>
@@ -995,9 +992,6 @@
<DependentUpon>ReconnectGroup.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="UI\Forms\TextBox.resx">
<DependentUpon>TextBox.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Forms\FrmUnhandledException.resx">
<DependentUpon>FrmUnhandledException.cs</DependentUpon>
</EmbeddedResource>