在上位机的设计过程中,有的时候需要增加些曲线显示,UI界面更改等操作。

  在上位机上,从下位机接收到数据以后,不能直接在串口接收的线程中更改上述操作,会出现错误,这个

时候采用BeginInvoke线程方法,便可以杰觉这个问题。

  

//封装委托
private void UpdateStatus(string a)
{
    this.MCUSendDataProcessing(a);
}

//事件委托出去
private delegate void UpdateStatusDelegate(string a);

//在使用时,调用
this.BeginInvoke(new UpdateStatusDelegate(UpdateStatus), new object[] {receive});

 

  

 

  

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-04
  • 2021-10-22
  • 2021-09-15
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-05
  • 2021-09-08
  • 2021-11-12
  • 2022-12-23
相关资源
相似解决方案