阅读156 返回首页    go 京东网上商城


RichTextBox指定文本高亮显示

            this.richTextBox1.Text = " 如果只选中一个文字,如果……";
            string strKey = "如果";

            int start = 0;
            int end = this.richTextBox1.Text.Length;

            int index = richTextBox1.Find(strKey, start, end, RichTextBoxFinds.None);
            while (index != -1)
            {
                richTextBox1.SelectionFont = new Font(richTextBox1.SelectionFont, FontStyle.Underline | FontStyle.Bold);
                richTextBox1.SelectionColor = Color.Blue;
                start = index + strKey.Length;
                index = richTextBox1.Find(strKey, start, end, RichTextBoxFinds.None);
            }

查找指定文本并加粗、下划线以蓝色显示

最后更新:2017-04-03 05:39:41

  上一篇:go C# 读取Excel中的数据
  下一篇:go C# 读取Excel中的数据