-
[Resolved]Graphics
I basically have a Graphics object to a standard Windows Panel. but when it gets covered/minimized, the stuff I've drawn is disappeared. redrawing it is not an option. is there anyway I can take a snap-shot at the panel just before it gets minimized/covered so I can put the snapshot back using the Paint event?
-
You can make your drawing creating a bitmap in memory and draw the bit map in the paint event.
1 Create a bitmap object
m_objDrawingSurface= new Bitmap(640, 480,
System.Drawing.Imaging.PixelFormat.Format24bppRgb);
2 Put this object in the load event
3 Initialize your graphics object
objGraphics = Graphics.FromImage(m_objDrawingSurface);
4 objGraphics.Clear(SystemColors.Control);
5 draw on this object
Lastly on the paint event use the following
objGraphics = e.Graphics;
// Draw the contents of the bitmap on the form.
objGraphics.DrawImage(m_objDrawingSurface, 0,0,
m_objDrawingSurface.Width,
m_objDrawingSurface.Height);
objGraphics.Dispose();
Hope u get it :)