Invoke(new MethodInvoker(delegate
{
textBox1.Enabled = true;
}));
上面是简单缩写,也可以写成
private void btnOK_Click(object sender, EventArgs e)
{
Thread td = new Thread(new ThreadStart(threadRun));
td.Start();
} /// <summary>
/// 原线程方法
/// </summary>
private void run()
{
this.tslInfo.Text = "就绪";
} /// <summary>
/// 线程方法
/// </summary>
private void threadRun()
{
MethodInvoker In = new MethodInvoker(run);
this.BeginInvoke(In);
}