0
点赞
收藏
分享

微信扫一扫

074 C# =>052

吓死我了_1799 2023-07-18 阅读 50

{
			this.lblV.Text=data;
		}),this.txtV.Text);
	});
	thread.IsBackground= true;
	thread.Start();

}

1,跨线程访问组件:

if(this.lblResult1.InvokeRequired)

{

 this.lblResult1.Invoke(

 new Action<string>(data=>{this.lblResult1.Text=data;}),

 i.Tostring()

 );

}

2,read control value crossing thread

private void btnRead_Click(object sender,EventArgs e)

{

 Thread thread = new Thread(()=>

 {

  this.txtV.Invoke(new Action<string>(data=>

   

  {

   this.lblV.Text=data;

  }),this.txtV.Text);

 });

 thread.IsBackground= true;

 thread.Start();


}

举报

相关推荐

0 条评论