使用窗口的Form.AcceptButton 属性,把窗口AcceptButton 属性设置成登录按钮,当用户输入回车时,就会执行登录按钮相应事件。
来源:https://blog.csdn.net/yb305/article/details/52241724