111,129
社区成员
发帖
与我相关
我的任务
分享
private void Form1_Load(object sender,EventArgs)
{
//设置串口和波特率
}
public void testMain() //处理串口数据的方法
{
while(true)
{
//处理串口数据
}
//线程停止
}
private void serialPort1_DataReceived(object sender,SerialDataReceivedEventArgs e)
{
//获取串口数据
//线程执行
}
this.Invoke((EventHandler)delegate
{
//访问ui资源的代码
});
RichTextBox rtb = new RichTextBox();
string msg = "hello world";
this.Invoke(new Action(() => { rtb.AppendText(msg); }));