1.使用RichTextBox,难免要在多线程调用,所以需要委托。

     Color定义此条信息用什么颜色显示。可以不同的颜色显示不同的信息。

 private void ShowMsg(Color color,string msg)
        {
            this.Invoke(new Action(() => {             

                rLog.Select(rLog.TextLength, 0);
                //滚动到控件光标处   
                rLog.ScrollToCaret();
                rLog.SelectionColor = color;
                rLog.AppendText(DateTime.Now.ToString("HH:mm:ss ") + msg + "\r\n");
            }
            ));
        }