How can i use a button to erase something which has been drawn in windows form?
Please guide me.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Joe WilsonPosted Jun 28, 2014, 7:44 AM
Farhan ShariffPosted Jun 27, 2014, 10:30 AM
or use void clear()
The example requires that you have created a Panel, a Button, and at least one other control on a Form. The other controls are added to the Panel control, and the Panel added to the Form. When the button is clicked, all the controls contained in the panel are removed from the Control.ControlCollection.
// Clear all the controls in the Panel.
private void clearButton_Click(object sender, System.EventArgs e)
{
panel1.Controls.Clear();
}
Remove all event handlers
http://stackoverflow.com/questions/91778/how-to-remove-all-event-handlers-from-a-control
if you want to undo a draw you've already done, you'd have to do something like reversible paint does, or you'll have to redraw the original image when you want to undo your draw.
Joe WilsonPosted Jun 27, 2014, 9:54 AM
Farhan ShariffPosted Jun 27, 2014, 7:27 AM