Reputation: 856
I've little question to ask.
Let's say I've written an ellipse on pictureBox, then clicked a button. I want pictureBox to refresh itself.
I've tried PictureBox.Invalidate()
, but could'nt made it.
My best regards...
Upvotes: 13
Views: 47785
Reputation: 158
There are a couple ways to update the PictureBox, and the method you use makes a difference if you have some lag. I had a program that drew typed characters in a PictureBox, and the keystroke processing was slow so when I typed fast it would lag.
If I pictureBox.Refresh();
after each keystroke, then that refreshes the picture immediately after the keystroke is processed, no matter what. This way, when I typed fast I could see the PictureBox trying to catch up with me as it drew each character.
If instead I pictureBox.Invalidate();
, then that refreshes the picture too, but only when the system has some free time. This way, when I typed fast I saw nothing happening while the system tried to catch up, and then everything I'd typed suddenly appeared.
Usually Refresh is better, but here's an article that describes a couple situations where Invalidate is the better choice.
Upvotes: 2
Reputation: 1397
Have you tried PictureBox.Update();
? Or try something like this http://msdn.microsoft.com/en-us/library/system.windows.forms.picturebox.image.aspx
Upvotes: 2