C# 跨线程设置TextBox.Text
delegate void SetTextCallback(string text);
public Form1()
{
InitializeComponent();
}
public void SetText(string text)
{
if (this.textBox1.InvokeRequired)
{
SetTextCallback d = new SetTextCallback(SetText);
this.Invoke(d, new object[] { text });
}
else
{
this.textBox1.Text = text;
}
}