question about paint.

I draw some image on a panel by clicking a button , and it works good. But when I minimize the form and restore it, the image is gone...

Then I  worte a sub handle panel's paintevent and now it works.

My question is , is it the only way to keep the image by handling the onpaint event  

thanks for any help.


Answer this question

question about paint.

  • Azeem Sarwar

    Yes, unless you use a retained mode graphics system. When you draw something in a paint event, it is temporary. You must redraw in the next paint event. If you use a retained mode graphics system (like the one in my signature) you don't draw anything, you create graphical objects, and they know how to repaint themselves.
  • ckelsoe

    Depending on what you're doing, you can use a PictureBox and set it's background image to a bitmap you've painted onto.  That will be retained without the need to repaint on every paint event.
  • suncream

    thanks a lot  for your help. :-)
  • question about paint.