C# 线程中操作空间

1.在Form1类中添加以下代码

 private delegate void UpdateStatusDelegate(string status);
        private void UpdateStatus(string status)
        {
            this.textBox1.Text = status;
        }

2.

 private void OnBtUsbRead(object sender, EventArgs e)
        {
            Thread t = new Thread(new ThreadStart(Go));
            t.Start();   // Run Go() on the new thread.
            Go();        // Simultaneously run Go() in the main thread.
         }
        private  void Go()
        {
            this.BeginInvoke(new UpdateStatusDelegate(UpdateStatus), new object[] { "123"});
        }
原文地址:https://www.cnblogs.com/yuqilihualuo/p/4199679.html