How do you roate an image inside of a PictureBox
? I have a simple pacman.gif image in my PictureBox
and it works fine at runtime (moving in all directions). But I want to rotate my gif as I press Left or Right key.
Actually it rotates fine but at runtime the animation stops working.
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
switch (e.KeyCode)
{
case Keys.Left:
pictureBox1.Left -= 7;
break;
case Keys.Right:
pictureBox1.Image.RotateFlip(RotateFlipType.RotateNoneFlipX);
pictureBox1.Left += 7;
break;
case Keys.Up:
pictureBox1.Top -= 7;
break;
case Keys.Down:
pictureBox1.Top += 7;
break;
}
}
Here's My Code. But gif isn't working.