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

  • 相关阅读:
    GARP和GVRP
    VLAN间路由
    Voice VLAN
    VLAN
    SSH
    Telnet
    FTP
    DHCP
    STP
    交换机
  • 原文地址:https://www.cnblogs.com/c-cccc/p/6189162.html
Copyright © 2011-2022 走看看