1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| 'Fonction Afficher :
Sub Afficher(ByVal Texte As String)
Try
If Texte.StartsWith("Info") Then
Texte = Texte.Remove(0, 5)
'Ca ne marche pas à partir d'ici non plus
Me.RTXT_CHAT.Text += Texte + vbNewLine
Me.RTXT_CHAT.Select(Me.RTXT_CHAT.Text.Length - Texte.Length, Texte.Length)
Me.RTXT_CHAT.SelectionColor = Color.Red
ElseIf Texte.StartsWith("Message") Then
Texte = Texte.Remove(0, 8)
Dim IsPseudo As Boolean = True 'Indique si la boucle en est au pseudo ou au message
Dim Pseudo As String = ""
For Each Caractere In Texte.ToCharArray 'décomposition pseudo//message pour mettre en couleurs sur le RichTextBox
If Caractere <> "]" Then
Pseudo += Caractere
Texte = Texte.Remove(0, 1)
Else
Pseudo += Caractere
Texte = Texte.Remove(0, 1)
Exit For
End If
Next
'C'est à partir d'ici que ça ne fonctionne pas...
Me.RTXT_CHAT.Text += Pseudo
Me.RTXT_CHAT.Select(Me.RTXT_CHAT.Text.Length - Pseudo.Length, Pseudo.Length)
Me.RTXT_CHAT.SelectionColor = Color.Green
Me.RTXT_CHAT.Text += Texte + vbNewLine
Me.RTXT_CHAT.Select(Me.RTXT_CHAT.Text.Length - Texte.Length, Texte.Length)
Me.RTXT_CHAT.SelectionColor = Color.Black
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub |