标签:金蝶盘点机 仓库条码管理wms系统 美萍盘点机 美萍条码数据采集器 美萍pd 仓库库位管理 智百威盘点机
本文实例讲述了C#键盘输入回车键实现点击按钮效果的方法,在C#项目开发中非常具有实用价值。分享给大家供大家参考。
具体实现方法如下:
把Form的KeyPreview设为true
然后设置KeyDown,KeyUp或KeyPress事件。在KeyDown事件中截获。
private void FormGongXuJinDu_KeyDown(object sender, KeyEventArgs e)
{
switch (e.KeyCode)
{
case Keys.Escape:
if (DialogResult.OK == MessageBox.Show("提示:您确定要退出吗?按【OK】确认退出,按【ESC】取消操作!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1))
{
this.Close();
}
break;
case Keys.Return:
{
if (textBox1.Focused == true || textBox2.Focused == true)
{
button1_Click(sender, e);
return;
}
}
break;
case Keys.F1:
break;
case Keys.F2:
break;
case Keys.F3:
break;
case Keys.F4:
break;
}
}标签:金蝶盘点机 仓库条码管理wms系统 美萍盘点机 美萍条码数据采集器 美萍pd 仓库库位管理 智百威盘点机
原文地址:http://blog.csdn.net/anjoly/article/details/46004187