private void Form1_KeyDown(object sender, KeyEventArgs e) { MainPlayer.Image = RotateImage((Bitmap)imgMainPlayer[1], angle); if (e.KeyCode == Keys.Left) { LeftRotate.Start(); } if (e.KeyCode == Keys.Right) { RightRotate.Start(); } if (e.KeyCode == Keys.Up) { UpMove.Start(); } if (e.KeyCode == Keys.Down) { DownMove.Start(); } }
private void Form1_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Left) { LeftRotate.Stop(); } if (e.KeyCode == Keys.Right) { RightRotate.Stop(); } if (e.KeyCode == Keys.Up) { UpMove.Stop(); } if (e.KeyCode == Keys.Down) { DownMove.Stop(); } if (UpMove.Enabled == false && DownMove.Enabled == false && LeftRotate.Enabled == false & RightRotate.Enabled == false) { MainPlayer.Image = RotateImage((Bitmap)imgMainPlayer[0], angle); } }