Foxtable(狐表)用户栏目专家坐堂 → [求助]RichTextBox 控件查找及定位


  共有2830人关注过本帖平板打印复制链接

主题:[求助]RichTextBox 控件查找及定位

帅哥,在线噢!
有点蓝
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106598 积分:542161 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/11/7 16:22:00 [只看该作者]

Dim richTextBox1 As System.Windows.Forms.RichTextBox = e.Form.Controls("Panel1").BaseControl.Controls(0)
Dim f As Font = New Font("Verdana", 8F, FontStyle.Italic, GraphicsUnit.Point)
Dim str As String = "要查找的字符"
Dim pos As Integer = richTextBox1.Find(str)
If pos > 0 Then
    richTextBox1.SelectionStart = pos
        richTextBox1.SelectionLength = str.Length
        richTextBox1.SelectionFont = f
        richTextBox1.SelectionColor = Color.Red
    End If


 回到顶部