public void showMsg(string msg)
{
if (label1.InvokeRequired)
{
OutDelegate d = new OutDelegate(showMsg);
this.Invoke(d, new object[] { msg });
return;
}
else
{
label1.Text = msg;
}
}
public delegate void OutDelegate(string text);
private void NewMethod2()
{
//业务逻辑
调用 showMsg(i.ToString());
}
Thread thread = new Thread(new ThreadStart( NewMethod2));
thread.Start();