public delegate void OutDelegate(string text);
public void OutText(string text)
{
if (listBox1.InvokeRequired)
{
OutDelegate outdelegate = new OutDelegate(OutText);
this.BeginInvoke(outdelegate, new object[] { text });
return;
}
listBox1.Items.Add(DateTime.Now.ToString() + "" + text);
listBox1.SelectedIndex = listBox1.Items.Count - 1;
}
把listBox1换成你需要的控件,把方法放在你的窗体cs上,子线程直接调用OutText方法即可