日期:2014-05-17 浏览次数:21275 次
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { base.ProcessCmdKey(ref msg, keyData); int WM_KEYDOWN = 256; int WM_SYSKEYDOWN = 260; bool _disable = false; if (msg.Msg == WM_KEYDOWN || msg.Msg == WM_SYSKEYDOWN) { if (keyData == Keys.Enter ) { switch (dg1.CurrentCellAddress.X) { case 0: SendKeys.Send("{Tab}"); SendKeys.Send("{Tab}"); SendKeys.Send("{Tab}"); SendKeys.Send("{Tab}"); _disable = true; break; case 1: SendKeys.Send("{Tab}"); SendKeys.Send("{Tab}"); SendKeys.Send("{Tab}"); _disable = true; break; case 2: SendKeys.Send("{Tab}"); SendKeys.Send("{Tab}"); _disable = true; break; case 3: SendKeys.Send("{Tab}"); _disable = true; break; case 4: SendKeys.Send("{Tab}"); _disable = true; break; } } } return _disable; }