2018-10-11胡志龙

智慧社区商超管理系统登录界面

一、功能描述

此登录界面实现了工作人员在商品管理系统中的登录功能。


二、各控件参数设置

1.窗体

属性
Text 登录
StartPosition CenterScreen
FormBorderStyle FixedToolWindow

2.Lable

属性
Text 角色\账号\密码

3.textbox

属性
MaxLength 9
Passwordchar *

4.LinkLable

属性
Text 忘记密码?

5.Button

属性
Text 登录\退出

6.pictureBox

属性
sizeMode Strtchlmage

7.comboBox

属性
DropDownstyle DropDownList

三、重要方法描述

1.角色默认值

private void Form1_Load(object sender, EventArgs e)
{
       this.comboBox1.SelectedIndex = 0;
}

2.登录

        private void button1_Click(object sender, EventArgs e)
        {
            if (comboBox1.Text == "收银员")
            {
                if (textBox1.Text == "110" && textBox2.Text == "123456")
                    MessageBox.Show("登陆成功", "", MessageBoxButtons.OK);
                else
                    MessageBox.Show("密码错误", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                if (textBox1.Text == "admin" && textBox2.Text == "12345")
                    MessageBox.Show("登陆成功", "", MessageBoxButtons.OK);
                else
                    MessageBox.Show("密码错误", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            
        }

3.点击按钮“退出”关闭程序

        private void button2_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

4.输入用户名后回车,光标跳转到密码输入框(KeyPress事件)

        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                SendKeys.Send("{tab}");
            }
        }

5.按Tab键进入密码输入框时,自动全选

       private void textBox2_Enter_1(object sender, EventArgs e)
        {
            ((TextBox)sender).SelectAll();
        }

6.输入密码后回车直接登陆(KeyPress事件)

        private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                button1_Click(sender,e);
            }
        }

五、待完善功能
具体如何取回密码;如何设置记住账号等

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容