商超登陆文档

2018-10-21  本文已影响0人  风下乘凉

1.登陆界面截图

界面截屏.gif

2.功能描述

实现收银员和库管员通过输入账号和密码登陆,正确显示登陆成功,失败显示登陆失败,点击推出就退出登陆界面。

控件

属性
TEXT 用户登录
MaximizeBox False
MinimizeBox False
StartPosition CenterScreen

label1

属性
TEXT 用户类型

label2

属性
TEXT 用户名

label3

属性
TEXT 密码

Linklabel1

属性
TEXT 忘记密码?

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

5.代码

        {
            if (textBox1.Text == "123456" && textBox2.Text == "123456")
                MessageBox.Show("登陆成功", "提示");
            else
                MessageBox.Show("用户名或密码错误", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
        }
 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;
        }
上一篇 下一篇

猜你喜欢

热点阅读