/// <summary> /// RichTextBox委托赋值函数 /// </summary> /// <param name="txt">TextBox</param> /// <param name="content">内容</param> private void SetDataText(RichTextBox txt, string content) { if (txt.InvokeRequired) { setDataTxt setThis = new setDataTxt(SetDataText); txt.Invoke(setThis, txt, content); } else { txt.Text = content; } }
/// <summary> /// RichTextBox委托赋值函数 /// </summary> /// <param name="txt">TextBox</param> /// <param name="content">内容</param> private void SetDataText(RichTextBox txt, string content) { if (txt.InvokeRequired) { setDataTxt setThis = new setDataTxt(SetDataText); txt.Invoke(setThis, txt, content); } else { //txt.Text = content; txt.AppendText(content + Environment.NewLine); txt.ScrollToCaret(); //function for auto scroll } }