I am making a game and I have to redraw about 40 objects on each Timer tick. I have about 7 classes with different Draw(Picturebox ^ pictureBox) methods. As you see I pass pictureBox pointer for each object draw method. As the objects are so many and maybe will be a little more, the pictureBox is flickering, because it draws each object after object. Is there a simple way to fix the flickering? Maybe somehow prepare the image and then show it on the PictureBox?
Share
That signature is very likely to create flicker. Because in order to take advantage of the double-buffering built into PictureBox, you have to also pass a Graphics object. The one you got from the Paint event. You are probably using CreateGraphics() now, a serious flicker bug.
The proper signature is Draw(Graphics^ graphics) and used like this:
With the assumption that you added the event handlers for the PictureBox and Timer control.