zoukankan      html  css  js  c++  java
  • WinForm richtextbox 关键字变红色


            private void HilightRichText(RichTextBox control, string hilightString)
            {
                int nSelectStart = control.SelectionStart;  
                int nSelectLength = control.SelectionLength;
                int nIndex = 0;
                while (nIndex < control.Text.Length)
                {
                    nIndex = control.Find(hilightString, nIndex, RichTextBoxFinds.WholeWord); //整个文档查找
                    if (nIndex < 0)
                    {
                        break;                     
                    }
                    control.Select(nIndex, hilightString.Length);      //选择文本
                    control.SelectionColor = Color.Red;
                    nIndex += hilightString.Length;
                }
                control.Select(nSelectStart, nSelectLength);
            }

  • 相关阅读:
    Git引用
    如何查看Git对象
    Git是如何存储对象的
    图形化的Git
    git中找回丢失的对象
    Git的Patch功能
    ES查看配置和查看全部配置
    增删改查
    Elasticsearch增、删、改、查操作深入详解
    ES博客链接
  • 原文地址:https://www.cnblogs.com/c-cccc/p/6189162.html
Copyright © 2011-2022 走看看