Back buffering with GDI and System.Drawing.Graphics
Greetings!
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():
Code:
Graphics myGFX = myControl.CreateGraphics()
The thing I'd like to do is, instead of retrieving a Graphics from myControl.CreateGraphics(),
I'd like to create a new Graphics object
Code:
Graphics myGFX = new Graphics(...);
Then draw to myGFX, and when done drawing, I'd like to SET the graphics of myControl = myGFX. To reduce flickering.
Code:
myControl.Graphics = myGFX; /* I know this don't work but that's want I want to accomplish... */
Is there a way to accomplish this?
Thanks!