1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| Public Function changecouleur(ByVal rtb As RichTextBox, ByVal chaineatrouver As String, ByVal Lcolor As System.Drawing.Color)
Dim longeurchaine As Integer = Microsoft.VisualBasic.Len(chaineatrouver)
Dim debutchaine As Integer = rtb.Find(chaineatrouver, RichTextBoxFinds.MatchCase)
'on fait un saut de ligne pour les prochaines lignes
rtb.Text = rtb.Text & vbCrLf
rtb.Focus()
'on selectionne la chaine a colorier
rtb.Select(debutchaine, longeurchaine)
rtb.SelectionColor = Lcolor
rtb.DeselectAll()
'on place le curseur a la fin
rtb.SelectionStart = rtb.Text.Length
End Function |
Partager