C# 密码框按回车,同时登录按钮回车
private void txbPassword_KeyPress(object sender, KeyPressEventArgs e) { //输入密码后按回车键直接登录 if (e.KeyChar == 13) { this.btn_Login.Focus(); this.btn_Login.PerformClick(); } }
智慧本身就是好的。有一天我们都会死去,追求智慧的道路还会有人在走着。死掉以后的事我看不到,但在我活着的时候,想到这件事,心里就很高兴。 —— 王小波
private void txbPassword_KeyPress(object sender, KeyPressEventArgs e) { //输入密码后按回车键直接登录 if (e.KeyChar == 13) { this.btn_Login.Focus(); this.btn_Login.PerformClick(); } }