【问题标题】:RichTextBox Highlight All Instances of a PhraseRichTextBox 突出显示短语的所有实例
【发布时间】:2011-03-12 23:17:06
【问题描述】:

在 VB.Net 中,是否可以突出显示短语的所有实例而不是仅突出显示单个实例,例如:

    txtView.SelectionStart = txtView.Find("ERROR: Invalid command entered.")
    txtView.SelectionColor = Color.Red

这将突出显示“错误:输入的命令无效。”,但是如果我的 RichTextBox 文本是:

错误:输入的命令无效。

错误:输入的命令无效。

错误:输入的命令无效。

或者,有没有一种方法可以在将线条写入 RichTextBox 时简单地为线条着色?提前致谢!

【问题讨论】:

    标签: vb.net richtextbox selection highlighting colors


    【解决方案1】:

    不,SelectionStart 和 SelectionLength 只有一个值。是的,您可以使用 SelectionBackColor 和 SelectionColor 属性为匹配的文本着色。您可以在我的回答中找到示例代码 this thread

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-12
      相关资源
      最近更新 更多