Richtextbox et les images

RJLFRANCE Messages postés 71 Date d'inscription samedi 17 août 2002 Statut Membre Dernière intervention 5 août 2012 - 9 juin 2003 à 18:21
RJLFRANCE Messages postés 71 Date d'inscription samedi 17 août 2002 Statut Membre Dernière intervention 5 août 2012 - 9 juin 2003 à 22:35
Je voudrais remplacer plusieurs signes par des images smiley dans un richtextbox comme par ex: salut :) grand chef , sa ne marche pas }:(
pour avoir :
salut :) grand chef , sa ne marche pas :(

j'ai deja utiliser la methode
SendMessage RichTextBox1.hWnd, &H302, 0, 0
mais elle fonctionne que pour 1 seule image
Pourriez vous m'aider ?
Merci

1 réponse

RJLFRANCE Messages postés 71 Date d'inscription samedi 17 août 2002 Statut Membre Dernière intervention 5 août 2012 1
9 juin 2003 à 22:35
j'ai trouver la solution, sa peut aider peut etre d'autre personne :

RTB1 et un controle richtextbox

tex$="salut :) grand chef , sa ne marche pas [}:(]

For a% = 1 To Len(tex$)
If Mid(tex$, a%, 1) = "[" Then ' je commence a chercher

If Mid(tex$, a%, 4) = " :) " Then
Clipboard.Clear
Clipboard.SetData Picture1(0).Picture 'le smiley
RTB1.SelText = " " '1 espace avant l'image
pause 0.2 'donne le temps au clipboard
RTB1.SetFocus
SendKeys "^v", True
a% = a% + 3
ElseIf Mid(tex$, a%, 4) = " :sad) " Then
Clipboard.Clear
Clipboard.SetData Picture1(1).Picture
RTB1.SelText = " " '1 espace avant l'image
pause 0.2
RTB1.SetFocus
SendKeys "^v", True
a% = a% + 3
ElseIf Mid(tex$, a%, 5) = "[}:(]" Then
Clipboard.Clear
Clipboard.SetData Picture1(2).Picture
RTB1.SelText = " " '1 espace avant l'image
pause 0.2
RTB1.SetFocus
SendKeys "^v", True
a% = a% + 4
ElseIf Mid(tex$, a%, 4) = " 8-) " Then
Clipboard.Clear
Clipboard.SetData Picture1(3).Picture
RTB1.SelText = " " '1 espace avant l'image
pause 0.2
RTB1.SetFocus
SendKeys "^v", True
a% = a% + 3
ElseIf Mid(tex$, a%, 4) = " :sleepy) " Then
Clipboard.Clear
Clipboard.SetData Picture1(4).Picture
RTB1.SelText = " " '1 espace avant l'image
pause 0.2
RTB1.SetFocus
SendKeys "^v", True
a% = a% + 3
End If

Else
RTB1.SelText = Mid(tex$, a%, 1)
End If
Next a%

sub pause (at as long)
dim t as long
t=timer
do until timer-t>at
doevents
loop
end sub
0
Rejoignez-nous