美文网首页
登录界面设计

登录界面设计

作者: 深海屿鹿_bd50 | 来源:发表于2018-10-14 20:35 被阅读0次

    1. 登录界面的效果图

    捕获.PNG
    2. 登录界面实现的功能描述
    通过不同的用户角色进行选择然后登陆自己账号,当用户输入的用户名或密码错误时,提示错误信息;当用户名和密码正确,进入主界面。
    3. 登录界面各控件的参数设置
    控件 属性
    label1 Text 用户类型
    label2 Text 用户名
    label3 Text 密码
    Linklabel Text 忘记密码?、
    comboBox Items 集合
    textBox2 Text
    textBox3 Text
    button1 Text 登陆
    button2 Text 取消

    4. 重要方法描述
    点击“取消”按钮退出登录界面

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

    5.需要完善的功能
    可以添加验证码的设置,增加安全性。
    6.参考代码

    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 label2_Click(object sender, EventArgs e)
            {
    
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
                this.comboBox1.SelectedIndex = 0;
            }
    
            private void label3_Click(object sender, EventArgs e)
            {
    
            }
    
            private void textBox4_TextChanged(object sender, EventArgs e)
            {
    
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                if (this.comboBox1.SelectedItem.ToString() == "收银员")
                {
                    if (this.textBox2.Text == "990990" && this.textBox3.Text == "123456")
                    {
                        MessageBox.Show("收银员登录成功");
                    }
                    else
                    {
                        MessageBox.Show("用户名或密码错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
    
                if (this.comboBox1.SelectedItem.ToString() == "库管员")
                {
                    if (this.textBox2.Text == "admin" && this.textBox3.Text == "admin")
                    {
                        MessageBox.Show("库管员登录成功");
                    }
                    else
                    {
                        MessageBox.Show("用户名或密码错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
    
            }
    
    
            private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
            {
    
            }
    
            private void label1_Click(object sender, EventArgs e)
            {
    
            }
    
            private void textBox2_TextChanged(object sender, EventArgs e)
            {
               
            }
    
            private void button2_Click(object sender, EventArgs e)
            {
                Application.Exit();
            }
    
            private void textBox3_TextChanged(object sender, EventArgs e)
            {
                
            }
        }
    }
    

    相关文章

      网友评论

          本文标题:登录界面设计

          本文链接:https://www.haomeiwen.com/subject/wddtzftx.html