C#程序 界面显示运行信息

  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");
            }
            ));
        }

 

posted @ 2019-12-12 13:34  ike_li  阅读(893)  评论(0编辑  收藏  举报