I have a form in which i paint a waveform on a button click that is as soon as i click button, the waveform displays. Now when i minimize the form and maximize it again, the waveform disappears.How to repaint it? I have seen people using paint event but i dont know how to use it after/inside the button click event. Please help.
How to use it and where? please if you can elaborate.
gn
2010-04-19 08:17:59
Windows automatically invalidates an area whenever it thinks it needs to be redrawn. It then sends notifications to the window(s) occupying that area on the screen, indicating they should re-paint the area. In .NET, this means the Paint event occurs.By calling Invalidate() on your control, you are manually telling Windows to send these notifications to your application.
deltreme
2010-04-19 12:51:04
You can call Invalidate() anywhere in your code, even multiple times before the Paint event occurs. It will just mark your control as "dirty"; you don't have to worry about calling the Paint event manually.
deltreme
2010-04-19 12:55:32
A:
How are you drawing the waveform in the click event? Are you drawing on a panel? If you are calling CreateGraphics to get a graphics instance, then anytime your form is minimized or if another form covers up your form, your drawing will be lost.
Check this site:
and this article in particular:
Chris Dunaway
2010-04-19 13:52:45