閱讀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中的數據