设为首页 加入收藏

TOP

C# 键盘输入回车键以点击按钮
2014-11-24 13:12:25 来源: 作者: 【 】 浏览:2
Tags:键盘 输入 回车 点击 按钮

把Form的KeyPreview设为true


然后设置KeyDown,KeyUp或KeyPress事件。在KeyDown事件中截获。


this.KeyDown += new KeyEventHandler(textBox1_KeyDown);


private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
this.L_login.Focus();
L_login_Click(this,new EventArgs());
}
}


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇类UNIX系统中启动脚本记录 下一篇C实现时间计算功能

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·MySQL 安装及连接-腾 (2025-12-25 06:20:28)
·MySQL的下载、安装、 (2025-12-25 06:20:26)
·MySQL 中文网:探索 (2025-12-25 06:20:23)
·Shell脚本:Linux Sh (2025-12-25 05:50:11)
·VMware虚拟机安装Lin (2025-12-25 05:50:08)