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; using StandardLibrary; namespace UserSettings { public partial class Form_UserLogin : Form { UserAccount userAccount; public Form_UserLogin(UserAccount userAccount) { InitializeComponent(); this.userAccount = userAccount; } private void Form_UserLogin_Load(object sender, EventArgs e) { cbb_UserName.SelectedIndex = 0; } private void bt_Login_Click(object sender, EventArgs e) { if (userAccount.UserLogin(userAccount.GetUserName(cbb_UserName.Text),txt_Password.Text)) { //MessageBox.Show("登录成功", "用户登陆", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); this.Close(); } else { txt_Password.Text = ""; txt_Password.Focus(); lab_Err.Visible = true; } } private void txt_Password_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { bt_Login_Click(null, null); } } private void bt_Exit_Click(object sender, EventArgs e) { this.Close(); } } }