窗体DataGridView控件中按回车键时,单元格向下移动,如何能改成向右移动

时间:2014-07-03 12:29:59   收藏:0   阅读:551

方法一:
protected override void OnKeyUp(System.Windows.Forms.KeyEventArgs e)
{
base.OnKeyUp(e);
if (e.KeyCode == System.Windows.Forms.Keys.Enter)
{
e.Handled = true;

System.Windows.Forms.SendKeys.Send("{TAB}");

}
}


protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData)
{
switch (keyData)
{
case System.Windows.Forms.Keys.Enter:
{
System.Windows.Forms.SendKeys.Send("{TAB}");
}

return true;
}
return base.ProcessCmdKey(ref msg, keyData);
}

 

这样就能把捕捉到的回车事件转换成TAB事件

窗体DataGridView控件中按回车键时,单元格向下移动,如何能改成向右移动,布布扣,bubuko.com

原文:http://www.cnblogs.com/starksoft/p/3821594.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!