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

方法一:
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事件

posted @ 2014-07-03 08:55  StarkSoft  阅读(791)  评论(1编辑  收藏  举报