delegate void SetTextCallback(string text);//后加的,好好想一想,参数是SetText带的参数。//From:www.uzhanbao.com
private void SetText(string text) { if (this.tBoxResult.InvokeRequired) { SetTextCallback d = new SetTextCallback(SetText); this.Invoke(d, new object[] { text }); } else { this.tBoxResult.AppendText(text); this.tBoxResult.Refresh(); } }
调用:
SetText("test");