简体   繁体   中英

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

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM