Back buffering with GDI and System.Drawing.Graphics
I'm doing a simple game in C# where I'd like to use back buffering with GDI and System.Drawing.Graphics.
I get the Graphics object from Control.CreateGraphics():
The thing I'd like to do is, instead of retrieving a Graphics from myControl.CreateGraphics(),
Graphics myGFX = myControl.CreateGraphics()
I'd like to create a new Graphics object
Then draw to myGFX, and when done drawing, I'd like to SET the graphics of myControl = myGFX. To reduce flickering.
Graphics myGFX = new Graphics(...);
Is there a way to accomplish this?
myControl.Graphics = myGFX; /* I know this don't work but that's want I want to accomplish... */