GIS与人工智能是未来GIS的归宿

为我们的世界建模

导航

C#在线程中调用控件的方法

C#在线程中调用控件的方法

public delegate void CallSetLogin();

private void btnOK_Click(object sender, EventArgs e)

{

Thread pThread = new Thread(new ThreadStart(Login));

     pThread.Start();

}

private void Login()

{

SetLogin();

}

private void SetLogin()

{

try

     {

         if (this.InvokeRequired)

          {

              CallSetLogin pCallSetLogin = new CallSetLogin(SetLogin);

              this.Invoke(pCallSetLogin);

          }

          else

          {

              txtUserName.Text = "1191120815";

          }

      }

      catch { }

}

posted on 2010-06-12 15:16  kisstome88  阅读(591)  评论(0编辑  收藏  举报