WinForm异步更新界面
this.Invoke((MethodInvoker)delegate { textBox1.AppendText(tmp + "\r\n"); });
Action act = () =>
{
txt.AppendText(value);
};
if (txt.InvokeRequired) //非当前线程
txt.Invoke(act);
else
act();
label1.Invoke((Action)(() => { label1.Text = "执行完毕!"; }));//这里跨线程访问UI需要做处理
浙公网安备 33010602011771号