So yeah,
Basically I drew something on a form using Graphics. Now if I move a window over the form the stuff I drew gets erased.
Is there a way to preserve the drawing?
(I'm using Windows.Forms)
So yeah,
Basically I drew something on a form using Graphics. Now if I move a window over the form the stuff I drew gets erased.
Is there a way to preserve the drawing?
(I'm using Windows.Forms)
Don't draw to the Form from outside the Paint event handler (which is what it sounds like you may be doing).
You can either redraw the contents every time in your Paint event handler, or you can paint once to an offscreen bitmap and then just display the bitmap in your Paint handler.
The code for both is almost identical, but to draw to an offscreen bitmap you need to set up a new bitmap for the Graphics context to draw into.
Here's an example which illustrates everything you need to do to use an offscreen bitmap to store the image. (And indeed, if you remove the offscreen-bitmap code from this example, the remaining code is how to draw in the Paint handler)