[英]Real-time Zedgraph does not respond
当我将焦点从另一个程序更改为实时程序时,我的实时不再响应。 即卡住了。
您能否建议我一个可能的原因和/或解决方案。
因为您的GUI线程(后台)没有得到处理 ,所以当它失去焦点时,不会更新您的Zedgraph。 如果将窗口移到ZedGraph上,则不会重新绘制该窗口。 相反,您将看到聚焦的窗口。 那是我的第一个猜测。 由于我不了解您的编程语言和代码,因此我将仅展示C#的原理。
计时器或新的数据事件调用函数RealTimeGraph
。 提示是,除了GUI线程外,还有一个额外的线程称为RealTimeGraph
。 Systems.Timers.Timer
类已经为您做到了。 使用哪个Timer或BackgroundWorker取决于您的应用程序。
System.Timers.Timer timer = new System.Timers.Timer();
timer.Elapsed += new ElapsedEventHandler(RealTimeGraph)
Public void RealTimeGraph(object sender, EventArgs e)
{
if (this.InvokeRequired)
{
PeriodicUpdateHandler update = new PeriodicUpdateHandler(this.RealTimeGraph);
this.BeginInvoke(periodisches_update,sender, e);
}
else
{
Update(); // check if new data for ZedGraph is available
ZedGraph.GraphPane.AxisChange(); // optional, if ZedGraphAxis has to be recomputed
ZedGraph.control.Invalidate(); // optional
ZedGraph.control.Refresh(); // now the update is visible
}
}
另外,如果您再次关注应用程序,则调用RealTimeGraph
可能会很方便。 只需添加一个新的焦点事件处理程序即可。
this.Enter += new System.EventHandler(this.RealTimeGraph);
我希望向您展示此概念的优点。 有关更多详细信息,请编辑与您的问题有关的代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.