您的位置:首页 > 编程语言 > VB

VB.net RichBox关键字高亮源代码

2020-03-02 02:22 756 查看

RichBox 属性Name : TextError

Private Function Colored_keywords(ByVal keywords As String) As Boolean

Dim startText As Integer = 0
Dim endText As Integer
endText = TextError.Text.LastIndexOf(keywords)
TextError.SelectAll()
While startText < endText
TextError.Find(keywords, startText, TextError.TextLength, RichTextBoxFinds.MatchCase)
TextError.SelectionColor = Color.Brown
startText = TextError.Text.IndexOf(keywords, startText) + 1
End While
Me.Refresh()
Return True
End Function
  • 点赞
  • 收藏
  • 分享
  • 文章举报
Sera 山山 发布了6 篇原创文章 · 获赞 0 · 访问量 144 私信 关注
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: