日期:2014-05-18  浏览次数:20721 次

C#窗体应用
C#窗体应用:按一下回车,光标跳到密码,再按一下回车,跳到登录按钮,再按一下,登录。 求代码

------解决方案--------------------
注册两个文本框的 KeyPress 事件,按钮不用额外处理
C# code
private void 用户名文本框_KeyPress(object sender, KeyPressEventArgs e)
{
    if (e.KeyChar == '\r')
    {
        this.密码文本框.Focus();
    }
}

private void 密码文本框_KeyPress(object sender, KeyPressEventArgs e)
{
    if (e.KeyChar == '\r')
    {
        this.登录按钮.Focus();
    }
}