在KeyPress中无法捕捉到事件
private void MainForm_KeyPress(object sender, KeyPressEventArgs e)
{
if(e.KeyChar.ToString().ToUpper() == Keys.Up.ToString())
{
}
}
必须在KeyDown中处理
private void MainForm_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Up)
{
}
if (e.KeyCode == Keys.Down)
{
}
}