zoukankan      html  css  js  c++  java
  • C# RichTextBox插入带颜色数据

     #region 日志记录、支持其他线程访问  
    
            public delegate void LogAppendDelegate(Color color, string text);
    
            public void LogAppendMethod(Color color, string text)
            {
                if (!richTextBoxOutPut.ReadOnly)
                    richTextBoxOutPut.ReadOnly = true;
                this.richTextBoxOutPut.Select(this.richTextBoxOutPut.Text.Length, 0);
                this.richTextBoxOutPut.Focus();
                richTextBoxOutPut.SelectionColor = color;
                richTextBoxOutPut.AppendText(text);
            }
    
            public void LogError(string text)
            {
                LogAppendDelegate la = new LogAppendDelegate(LogAppendMethod);
                richTextBoxOutPut.Invoke(la, Color.Red, DateTime.Now.ToString("[yyyy-MM-dd HH:mm:ss] ") + text);
            }
            public void LogWarning(string text)
            {
                LogAppendDelegate la = new LogAppendDelegate(LogAppendMethod);
                richTextBoxOutPut.Invoke(la, Color.Blue, DateTime.Now.ToString("[yyyy-MM-dd HH:mm:ss] ") + text);
            }
            public void LogMessage(string text)
            {
                LogAppendDelegate la = new LogAppendDelegate(LogAppendMethod);
                richTextBoxOutPut.Invoke(la, Color.Green, DateTime.Now.ToString("[yyyy-MM-dd HH:mm:ss] ") + text);
            }
    
            #endregion
  • 相关阅读:
    链表-(1)
    爬虫(10-3)验证码图片识别
    爬虫10-2(多线程爬虫)
    分布式爬虫系统的架构(19)
    pipenv管理Python虚拟环境
    peewee-async集成到tornado
    Python3笔记051
    Python3笔记050
    Python3笔记049
    Python3笔记048
  • 原文地址:https://www.cnblogs.com/zhaogaojian/p/9014212.html
Copyright © 2011-2022 走看看