作业1

作者: T_e881 | 来源:发表于2018-10-20 23:33 被阅读0次

1. 登录界面的效果图

2. 登录界面实现的功能描述

不同身份人员登陆,显示不同功能和信息

3. 登录界面各控件的参数设置

控件label1

属性
Text 用户类型

控件label2

属性
Text 用户名

控件label3

属性
Text 密码

控件A

属性
Text 登陆界面
MaximizeBox False
MinimizeBox False

控件Linklabel1

属性
Text 忘记密码

控件conboBox1

属性
DropDownStyle DropDownList
DropDownStyle comboBox1_SelectedIndexChanged

控件textBox2

属性
Click textBox2_Click
KeyPress textBox2_KeyPress
TextChanged textBox2_TextChanged

控件textBox3

属性
Click textBox3_Click
KeyPress textBox3_KeyPress
TextChanged textBox3_TextChanged

控件Button1

属性
Text 登陆
UseVisualStyleBackColor False
Click button1_Click

控件Button2

属性
Text 取消
UseVisualStyleBackColor False
Click button2_Click

4. 重要方法描述

1.登录窗口边框固定,且不能最大最小化

在Form窗口下,右击属性,在FormBorderStyle中选择FixdeSingle;将MaximizeBox和MinimizeBox设置为False.

2.用户名最大长度为9个字符,密码不可见

在用户名对应的TextBox控件中,将MaxLength值设置为9;
在密码对应的TextBox控件中,将PasswordCha设置为*

5.代码

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 Form1_Load(object sender, EventArgs e)
        {
            this.comboBox1.SelectedIndex = 0;
        }
        private void label1_Click(object sender, EventArgs e)
        {
           
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (this.comboBox1.SelectedItem.ToString() == "收银员")
            {
                if (this.textBox1.Text == "123456" && this.textBox2.Text == "123456")
                {
                    MessageBox.Show("收银员登录成功");
                }
                else
                {
                    MessageBox.Show("用户名或密码错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            if (this.comboBox1.SelectedItem.ToString() == "库管员")
            {
                if (this.textBox1.Text == "admin" && this.textBox2.Text == "admin")
                {
                    MessageBox.Show("库管员登录成功");
                }
                else
                {
                    MessageBox.Show("用户名或密码错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        private void button2_Click(object sender, EventArgs e)//退出
        {
            Application.Exit();
        }
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            
        }
       
    }
}

相关文章

  • 作业1

  • 作业1

  • 作业1

    首先感谢各位老师的辛勤付出,谢谢你们,辛苦了!3天的康复理疗课程收获满满,让我对精油的化学成份,科学层面有了更深入...

  • 作业1

    问题1 请设计一个算法,要求该算法把二叉树的叶子结点按从左到右的顺序连成一个单链表,表头指针为head。二叉树按二...

  • 作业1

    假如你有一个15岁的孩子,有一天晚上吃饭时,他对你说:“我感觉学习一点意思都没有,老师教的东西一点用处都没有。我将...

  • 作业1

  • 作业1

    一、1.什么是HTML5万维网的核心语言、标准通用标记语言下的一个应用超文本标记语言(HTML)的第五次重大修改。...

  • 作业1

    1. 登录界面的效果图 2. 登录界面实现的功能描述 不同身份人员登陆,显示不同功能和信息 3. 登录界面各控件的...

  • 作业1

  • 作业1

    #代码 using System; using System.Collections.Generic; using...

网友评论

      本文标题:作业1

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