How could I refresh a line chart after the form has been minimized?

4.5k views Asked by At

In Visual C#, I built a component(not a user control) to draw a data line chart to display datas coming from socket. I put the drawing codes in the Paint event, so I called Invalidate after a new data pack comes. But when the form is minimized, it seems the drawing has been stoped. After the form is restored,there are some data in the buffer still need to be refresh , which cause a delay of the display (depends on how long the form has been keep minimized).

What is the machnism should I use to refresh the line chart even if it is not displayed?

1

There are 1 answers

1
Jens Meinecke On

call Invalidate() to tell the system that, next time it becomes visible it should be redrawn (you're already doing this)

then call Update() which forces the redraw to take place right now (you might want to make this call only if you are minimized)

Alternatively simply call the

Refresh() method.