1. 登录界面的效果图
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. 重要方法描述
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (this.comboBox1.SelectedItem.ToString() == "收银员")
{
if (this.textBox1.Text == "123456789" && this.textBox2.Text == "123456")
{
MessageBox.Show("收银员登录成功");
}
else
{
MessageBox.Show("用户名或密码错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void label3_Click(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
this.comboBox1.SelectedIndex = 0;
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
this.comboBox1.SelectedIndex = 0;
}
private void textBox1_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_TextChanged(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void textBox1_Enter(object sender, EventArgs e)
{
((TextBox)sender).SelectAll();
}
private void Form1_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)
{
SendKeys.Send("{tab}");
}
}
}
}