dissapearing shapes, ponits
-
6 aprilie 2006 12:31Welcome
Hi I have a problem. I have to do a program in which user can draw many different things (something like paint). The problem is that when i minimize or move outside the desktop it all dissapears. I know there must ba a way to remember things. How can i do that? is there something to remember this drawing area? I must admit that i don't want to do any list of functions to redraw everytjing from every time. i don't need undo too. I just want to have all i have drawed to remain on the area.
Please help. Thank you
Kamil Lipiński, student
Toate mesajele
-
6 aprilie 2006 12:37ModeratorI geus you are not painting in the Paint event of the control?
If so, refactor your code so the painting is done in the Paint event, because this event gets fired when a piece needs a paint or a repaint.
You can remember (cache) things by drawing it on a in-memory Bitmap and paint a piece of the Bitmap on the Graphics object when needed. -
6 aprilie 2006 12:47Where can i found any help about using this in-memory bitmap? is there any class or something?
is there no other way? any "context" :P or something? -
6 aprilie 2006 12:51Moderator
A little self-explaining short example:
Bitmap bitmap = new Bitmap( 500, 500 );
using( Graphics g = Graphics.FromImage( bitmap ))
{
// TODO: Do paint logic here.
}