C# DataGridView点击Enter键切换单元格

时间:2014-06-29 20:04:19   收藏:0   阅读:343

#region 将ENTER键转换为TAB
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);
}
#endregion

C# DataGridView点击Enter键切换单元格,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!