日期:2014-05-18 浏览次数:20964 次
delegate void SetTextCallback(string text);
private void textBox1SetText(string str)
{
if (this.textBox3.InvokeRequired)
{
SetTextCallback d = new SetTextCallback(textBox1SetText);
this.Invoke(d, new object[] { str });
}
else
{
this.textBox3.Text = this.textBox3.Text + "\r\n" + str;
}
}
private void Foo()
{
textBox1SetText("abc");
}
private void button10_Click(object sender, EventArgs e)
{
Thread t = new Thread(new ThreadStart(Foo));
t.Start();
}