0
Public Sub textcolorchanged()
Dim searchword As String = RichTextBox2.Text.ToString.Trim
Dim index1 As Integer = 0
While index1 <> -1
If (index1 < ORGFILETXT.Text.Length) Then
index1 = ORGFILETXT.Find(searchword, index1, RichTextBoxFinds.None)
'If (index1 <= ORGFILETXT.TextLength) Then
If index1 <> -1 Then
ORGFILETXT.SelectionStart = index1
ORGFILETXT.SelectionLength = searchword.Length
ORGFILETXT.SelectionColor = Color.Red
index1 = index1 + searchword.Length
End If
'End If
Else
index1 = -1
End if
End While
End Sub
我搜索了datagridview1行的單詞,並在富文本框中突出顯示搜索詞。文本(它是總文本) 我在datagridview1中將此方法稱爲鼠標單擊和鍵盤按鍵事件richtextbox中的高亮顯示顏色
單詞在富文本框中突出顯示,當我用鼠標單擊並鍵入並按下鍵時datagridview1行的搜索詞,但有時得到全文更改顏色如何? 請幫幫我