C#跨线程访问控件
时间:2014-03-17 12:29:13
收藏:0
阅读:253
public delegate void MyInvoke(string str); private void button9_Click(object sender, EventArgs e) { //_myInvoke = new MyInvoke(SetText); //CheckForIllegalCrossThreadCalls = false; Thread t = new Thread(new ThreadStart(fun)); t.Start(); } private void fun() { //_myInvoke("dddd"); SetText("ddd"); } private void SetText(string s) { if (textBox6.InvokeRequired) { MyInvoke _myInvoke = new MyInvoke(SetText); this.Invoke(_myInvoke, new object[] { s }); } else { this.textBox6.Text = s; } }
原文:http://www.cnblogs.com/bcodesoft/p/3604155.html
评论(0)
