简体   繁体   English

最小化表单后如何刷新折线图?

[英]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. 在Visual C#中,我构建了一个组件(不是用户控件)来绘制数据折线图以显示来自套接字的数据。 I put the drawing codes in the Paint event, so I called Invalidate after a new data pack comes. 我将绘图代码放入Paint事件中,因此在出现新的数据包后,我调用了Invalidate。 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) 调用Invalidate()告诉系统,下次可见时应重新绘制(您已经在执行此操作)

then call Update() which forces the redraw to take place right now (you might want to make this call only if you are minimized) 然后调用Update() ,以强制立即进行重绘(仅在最小化的情况下,您可能要进行此调用)

Alternatively simply call the 或者,只需致电

Refresh() method. Refresh()方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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