您的位置:首页 > 移动开发 > Objective-C

多线程操作窗体控件

2008-08-01 09:05 316 查看
delegate void SetTextCallback(string text);<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

          private void SetText(string text)

          {

              // InvokeRequired required compares the thread ID of the

              // calling thread to the thread ID of the creating thread.

              // If these threads are different, it returns true.

              if (this.textBox1.InvokeRequired)

              {

                  SetTextCallback d = new SetTextCallback(SetText);

                  this.Invoke(d, new object[] { text });

              }

              else

              {

                  this.textBox1.Text = text;

              }

          }

 

SetText(time.ToString());
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息