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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Farhan ShariffRank #2,004 · 725 reputationPosted Jun 27, 2014, 3:27 AM EDT
Joe WilsonRank #631 · 3.8K reputationPosted Jun 27, 2014, 5:54 AM EDT
Farhan ShariffRank #2,004 · 725 reputationPosted Jun 27, 2014, 6:30 AM EDT
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 WilsonRank #631 · 3.8K reputationPosted Jun 28, 2014, 3:44 AM EDT