Question Clearing a drawn panel

Mamta

New member
Joined
May 20, 2011
Messages
2
Programming Experience
1-3
how to clear lines drawn on a panel.on some event i want to clear lines which r previosly drawn
 
Use panel.Refresh method to have the whole control invalidated and repainted. At this point you then don't draw those lines from the controls Paint event handler like you did before.
 
Thanks John.Here I m not drawing lines in the paint event of panel.m drawing the lines on mousemove event of panel.after this m saving the image and all drawing parameters n now i want to refresh the panel by deleting all previosly drawn lines.On a new menu click i want to redraw new lines to have a new image 2 be saved.so my problem vl nt b solved by calling paint again
 
Any time a control redraws everything is drawn starting from nothing, so refreshing the control will also reset anything you have drawn to a 'hijacked' device context.
You should not draw to a control outside the paint event handler, because whenever the controls repaints what you put there will be lost, without you being able to maintain it.
 
Back
Top