-
Notifications
You must be signed in to change notification settings - Fork 0
/
AccountForm.cs
133 lines (117 loc) · 4.89 KB
/
AccountForm.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace AlphaIMS
{
public partial class AccountForm : Form
{
uTextBox userTextBox;
uTextBox passTextBox;
uTextBox confirmTextBox;
public AccountForm()
{
InitializeComponent();
this.BackColor = Color.FromArgb(44, 82, 110);
userTextBox = new uTextBox();
userTextBox.TipFont = new Font("微軟正黑體", 10);
userTextBox.TipColor = Color.FromArgb(255, 255, 255);
userTextBox.TipText = "帐号";
userTextBox.Font = new Font("微軟正黑體", 10);
userTextBox.TextAlign = HorizontalAlignment.Center;
userTextBox.ForeColor = Color.FromArgb(255, 255, 255);
userTextBox.AutoSize = false;
userTextBox.Size = new Size(180, 30);
userTextBox.Location = new Point(35, 50);
userTextBox.BackColor = Color.FromArgb(44, 82, 110);
userTextBox.BorderStyle = BorderStyle.FixedSingle;
userTextBox.TabIndex = 1;
this.userTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.userTextBox_KeyPress);
this.Controls.Add(userTextBox);
passTextBox = new uTextBox();
passTextBox.TipFont = new Font("微軟正黑體", 10);
passTextBox.TipColor = Color.FromArgb(255, 255, 255);
passTextBox.TipText = "密码";
passTextBox.Font = new Font("微軟正黑體", 10);
passTextBox.TextAlign = HorizontalAlignment.Center;
passTextBox.ForeColor = Color.FromArgb(255, 255, 255);
passTextBox.AutoSize = false;
passTextBox.Size = new Size(180, 30);
passTextBox.Location = new Point(35, 90);
passTextBox.BackColor = Color.FromArgb(44, 82, 110);
passTextBox.BorderStyle = BorderStyle.FixedSingle;
passTextBox.PasswordChar = '*';
passTextBox.TabIndex = 2;
this.passTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.passTextBox_KeyPress);
this.Controls.Add(passTextBox);
confirmTextBox = new uTextBox();
confirmTextBox.TipFont = new Font("微軟正黑體", 10);
confirmTextBox.TipColor = Color.FromArgb(255, 255, 255);
confirmTextBox.TipText = "确认";
confirmTextBox.Font = new Font("微軟正黑體", 10);
confirmTextBox.TextAlign = HorizontalAlignment.Center;
confirmTextBox.ForeColor = Color.FromArgb(255, 255, 255);
confirmTextBox.AutoSize = false;
confirmTextBox.Size = new Size(180, 30);
confirmTextBox.Location = new Point(35, 130);
confirmTextBox.BackColor = Color.FromArgb(44, 82, 110);
confirmTextBox.BorderStyle = BorderStyle.FixedSingle;
confirmTextBox.PasswordChar = '*';
confirmTextBox.TabIndex = 3;
this.confirmTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.confirmTextBox_KeyPress);
this.Controls.Add(confirmTextBox);
this.ActiveControl = titleLabel;
}
private void userTextBox_KeyPress(object sender, KeyPressEventArgs e)
{
errorLabel.Visible = false;
/*if (e.KeyChar == (Char)13)
{
this.SelectNextControl((Control)sender, true, true, true, true);
}*/
}
private void passTextBox_KeyPress(object sender, KeyPressEventArgs e)
{
errorLabel.Visible = false;
}
private void confirmTextBox_KeyPress(object sender, KeyPressEventArgs e)
{
errorLabel.Visible = false;
}
private void cancelBtn_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
}
private void createBtn_Click(object sender, EventArgs e)
{
if (userTextBox.Text == "")
{
errorLabel.Text = "请输入帐号";
errorLabel.Visible = true;
return;
}
if (passTextBox.Text == "")
{
errorLabel.Text = "请输入密码";
errorLabel.Visible = true;
//MessageBox.Show("请输入密码", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
if (confirmTextBox.Text == "")
{
errorLabel.Text = "请确认密码";
errorLabel.Visible = true;
return;
}
if (passTextBox.Text != confirmTextBox.Text)
{
errorLabel.Text = "密码错误";
errorLabel.Visible = true;
return;
}
}
}
}