I have problem with the Graphic object. I have a loop which goes through some array and it gets the images from them and It draws them on a picture box. Every thing is fine but When I try to resize or draw another thing which is a little bit more heavy, Every thing start flashing Like when they’re painting. I know it’s too heavy to draw all that damn things ! but is there any way to avoid tearing?
Thanks.
Edit:
my code:
graphic.Clear(frmmain.Workspace.BackColor)
For i = 0 To mObjectsList.Count - 1
graphic.DrawImage(mObjectsList(i).oGraphic, mObjectsList(i).oX, mObjectsList(i).oY, mObjectsList(i).oWidth, mObjectsList(i).oHeight)
Next
A picturebox doesn’t have a Graphic object. Do not use its CreateGraphics() method. Whatever you draw through that stays on the screen for only a fraction of a second, barely making a blip. Use e.Graphics in the Paint event handler instead. That draws into the double-buffered bitmap. PictureBox always has its DoubleBuffered property set to true. That bitmap gets drawn when the Paint event completes. Which is why your objects flicker, they get overdrawn again by that bitmap.