今天做的一个小东西,tcp/ip的数据传输问题,把子线程的值传递到主线程的空间中显示

 

可以使用委托实现

      public  delegate void MainC(bool a ,bool b,string URLStr);
      

        public void mainCtr(bool a,bool b,string URLStr)
        {
            this.webBrowser1.Visible = a;
            this.pictureBox1.Visible = b;
            this.webBrowser1.Url = new Uri(@"http://" + URLStr);
        }

 

 

子线程代码

      MainC deleMain = new MainC(mainCtr);

      this.Invoke(deleMain, true, false, URLStr);

 

 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-01
  • 2021-11-24
猜你喜欢
  • 2022-01-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案