智能商超登录
1.登录界面

收银员登入成功.gif

收银员登入失败.gif

库管员登入成功.gif

库管员登入失败.gif
2. 登录界面实现的功能描述
实现不同用户类型登陆。
3.登录界面各控件的参数设置
控件
属性 |
值 |
TEXT |
用户登录 |
MaximizeBox |
False |
MinimizeBox |
False |
StartPosition |
CenterScreen |
控件label1
控件label2
控件label3
Linklabel1
控件comboBox1
属性 |
值 |
DropDownStyle |
DropDownList |
SelectedIndexChanged |
comboBox1_SelectedIndexChanged |
控件textBox1
属性 |
值 |
MaxLength |
9 |
Click |
textBox1_Click |
KeyPress |
textBox1_KeyPress |
TextChanged |
textBox1_TextChanged |
textBox2
属性 |
值 |
Click |
textBox1_Click |
KeyPress |
textBox2_KeyPress |
Enter |
text Box1_Enter |
MaxLength |
6 |
Passwordchar |
* |
button1
属性 |
值 |
Text |
登陆 |
UseVisualStyleBackColor |
False |
Click |
button1_Click |
button2
属性 |
值 |
Text |
退出 |
UseVisualStyleBackColor |
False |
Click |
button2_Click |
4.重要方法描述
1.在Form窗口下,右击属性,在FormBorderStyle中选择FixdeSingle;将MaximizeBox和MinimizeBox设置为False,固定窗体。默认角色收银员。
2.输入用户名后回车,光标跳转到密码输入框。
3.输入密码后,回车直接登陆。
4.按TAB键进入输入框时,自动全选。
5.代码
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text == "666666" && textBox2.Text == "666666")
MessageBox.Show("登陆成功", "提示");
else
MessageBox.Show("用户名或密码错误", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
}
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Enter)
{
SendKeys.Send("{tab}");
}
}
private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Enter)
{
this.button1_Click(sender, e);
}
}
private void textBox1_Enter(object sender, EventArgs e)
{
((TextBox)sender).SelectAll();
}
private void textBox2_Enter(object sender, EventArgs e)
{
((TextBox)sender).SelectAll();
}
private void Form1_Load(object sender, EventArgs e)
{
this.comboBox1.SelectedIndex = 0;
}
}
}
网友评论