代码如下:
void MainFormKeyDown(object sender, KeyEventArgs e)
{
int intDev = 10;
switch(e.KeyCode)
{
case Keys.Left:
Image1.Left -= intDev;
break;
case Keys.Right:
Image1.Left += intDev;
break;
case Keys.Up:
Image1.Top -= intDev;
break;
case Keys.Down:
Image1.Top += intDev;
break;
default:
break;
}
}