I have simplified this to make sure nothing else is going on. So I have a windows form application, 1 form, 1 button and 1 picturebox. The following is the only code I have added.
private void button1_Click(object sender, EventArgs e)
{
pictureBox1.Image.RotateFlip(RotateFlipType.Rotate90FlipNone);
Application.DoEvents();
}
When I have a breakpoint in this routine the picture is shown as rotated. If Idon't have a breakpoint the picture does not rotate.
Any ideas? The code can't get more simple.
You need to call either Refresh()
or Invalidate()
function on PictureBox
control to Update it after Rotating.
From MSDN:Invalidate
Invalidates the entire surface of the control and causes the control to be redrawn.
Try : using Invalidate()
private void button1_Click(object sender, EventArgs e)
{
pictureBox1.Image.RotateFlip(RotateFlipType.Rotate90FlipNone);
pictureBox1.Invalidate();
Application.DoEvents();
}