-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathInputPassword.cs
40 lines (34 loc) · 1.05 KB
/
InputPassword.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System.Windows.Forms;
namespace FuKo
{
public partial class InputPassword : Form
{
public string Password { get { return this.txtPassword.Text; } }
public InputPassword()
{
InitializeComponent();
}
public new DialogResult ShowDialog()
{
this.DialogResult = DialogResult.None;
this.txtPassword.Text = null;
return base.ShowDialog();
}
private void txtPassword_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
this.DialogResult = this.txtPassword.TextLength > 0 ? DialogResult.OK : DialogResult.None;
this.Close();
}
}
private void InputPassword_Activated(object sender, System.EventArgs e)
{
this.txtPassword.Focus();
}
private void txtPassword_TextChanged(object sender, System.EventArgs e)
{
this.lblLen.Text = this.txtPassword.TextLength.ToString();
}
}
}