protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { switch (keyData) { case Keys.Right: _caret.StepForward(); break; case Keys.Left: _caret.StepBack(); break; case Keys.Up: _caret.Up(); break; case Keys.Down: _caret.Down(Lines); break; default: break; } //若要调用KeyDown,这里一定要返回false才行,否则只响应重写方法里的按键. //这里调用一下父类方向,相当于调用普通的KeyDown事件.//所以按空格会弹出两个对话框 return(base.ProcessCmdKey(ref msg, keyData)); }