智慧商超管理系統(tǒng)

一、登錄界面的效果圖

圖1.1登錄界面

二、登錄界面實(shí)現(xiàn)的功能描述

登錄界面默認(rèn)用戶類型為收銀員,支持超市管理員和收銀員的登錄,密碼找回及退出功能

三、登錄界面各控件的參數(shù)設(shè)置

Form1(窗體控件:Form1)

屬性
FormBorderStyle FixedSingle
MaximizeBox False
MinimizeBox False
StartPosition CenterScreen

comboBox1(登錄類型控件:cb_style)

屬性
DropDownStyle DropDownList
Items 管理員、收銀員

textBox1(用戶名控件:tb_user)

屬性
MaxLength 10

textBox2(用戶密碼控件:tb_pwd)

屬性
PasswordChar *

四、重要方法描述

4.1設(shè)置默認(rèn)收銀員代碼

private void Form1_Load(object sender, EventArgs e)
        {
            this.cb_style.SelectedItem = "收銀員";
        }

4.2登錄按鈕點(diǎn)擊事件

private void button2_Click(object sender, EventArgs e)
        {
            if (this.cb_style.SelectedItem == "管理員")
            {
                if (tb_user.Text == "2016270000" && tb_pwd.Text == "123456")
                {
                    MessageBox.Show("密碼正確", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    Form form2 = new Form2();
                    form2.ShowDialog();
                }
                else {
                    MessageBox.Show("用戶名或密碼錯誤", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            if (this.cb_style.SelectedItem == "收銀員")
            {
                if (tb_user.Text == "2016270386" && tb_pwd.Text == "19980602")
                {
                    MessageBox.Show("密碼正確", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    Form form2 = new Form2();
                    form2.ShowDialog();
                }
                else
                {
                    MessageBox.Show("用戶名或密碼錯誤", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }

4.3回車鍵換行

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

4.4Tab進(jìn)入密碼輸入框時,自動全選密碼

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

4.4回車鍵直接登錄

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

五、想一想,還有哪些尚需完善的功能

未完待續(xù)

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容