private void LoginForm_VisibleChanged(object sender, EventArgs e) { if (this.Visible) { TebPassword.Focus(); } }
private void BtnLogin_Click(object sender, EventArgs e) { //获取用户名和密码 UserMode user = (UserMode)Enum.Parse(typeof(UserMode), CobUser.Text); string password = TebPassword.Text; TebPassword.Clear(); if (UserChangingMethod != null) { //切换用户,返回切换后的用户 bool result = UserChangingMethod(user, password); if (result) { if (user == UserMode.Manager) { BtnManaMode.BaseColor = BtnManaMode.BaseColorEnd = Color.FromArgb(4, 86, 240); BtnOperaMode.BaseColor = BtnManaMode.BaseColorEnd = Color.Transparent; } else { BtnManaMode.BaseColor = BtnManaMode.BaseColorEnd = Color.Transparent; BtnOperaMode.BaseColor = BtnManaMode.BaseColorEnd = Color.FromArgb(4, 86, 240); } } } }
private void CobUser_SelectedIndexChanged(object sender, EventArgs e) { TebPassword.Focus(); }