BiGOuF
Messages postés90Date d'inscriptionvendredi 13 décembre 2002StatutMembreDernière intervention12 décembre 2007
-
7 nov. 2006 à 02:28
BiGOuF
Messages postés90Date d'inscriptionvendredi 13 décembre 2002StatutMembreDernière intervention12 décembre 2007
-
7 nov. 2006 à 15:04
Bonjour à tous,
je suis débutant en vb, et celà fait quelques jours que je cherche des tutos sur les RichEditBox pour VB6.
Je suis en train de faire un convertisseur de texte pour que celui-ci possède des tags pour forum phpBB.
J'arrive sans problème à generer le BBcode, mais je n'arrive pas à afficher un apperçu dans une RichEditBox.
Quand je tente un RichEditBox1.TextRTF = RichEditBox1.TextRTF & chr(13) & "Nouveau texte formaté", celui-ci ne s'ajoute pas.
J'ai toujours la première ligne dans la REB, mais pas la suite ... pourriez-vous m'aider ?
Merci d 'avance à tous :)
PCPT
Messages postés13272Date d'inscriptionlundi 13 décembre 2004StatutMembreDernière intervention 3 février 201847 7 nov. 2006 à 14:37
umm....
et comme çà?
Option Explicit
'
Const RTB_JAUNE As String = "\red255\green255\blue0"
Const RTB_ROUGE As String = "\red255\green0\blue0"
Const RTB_BLEU As String = "\red0\green0\blue255"
Const RTB_VERT As String = "\red0\green255\blue0"
Const RTB_VIOLET As String = "\red255\green0\blue255"
'
Private Sub Form_Load()
'
clear
RichTextBox1.Text = vbNullString
Call AddRichLine(RTB_JAUNE & ";" & RTB_VERT & ";" & RTB_BLEU, "Ce qui suit est en \cf1 \i Vert Italique \f0 \cf0
\i0")
Call AddRichLine(RTB_JAUNE & ";" & RTB_VERT & ";" & RTB_BLEU, "\cf2Ma Nouvelle Ligne")
End Sub
'
Sub AddRichLine(sColor As String, sLine As String)
RichTextBox1.SelStart = Len(RichTextBox1.Text)
If LenB(RichTextBox1.Text) > 0 Then
RichTextBox1.SelText = vbCrLf
RichTextBox1.SelStart = Len(RichTextBox1.Text)
End If
RichTextBox1.SelRTF = "{\rtf1\ansi {
\colortbl" & sColor & sLine & ";}" & sLine & "}"
End Sub
BiGOuF
Messages postés90Date d'inscriptionvendredi 13 décembre 2002StatutMembreDernière intervention12 décembre 2007 7 nov. 2006 à 14:38
A dire vrai, ca n'allège pas le code plus que le mien, mais merci beaucoup en tout cas, et j'espère que ca pourra aider d'autres neophytes comme moi :)
BiGOuF
Messages postés90Date d'inscriptionvendredi 13 décembre 2002StatutMembreDernière intervention12 décembre 2007 7 nov. 2006 à 15:01
Je viens de tester ceci, et ca me fonctionne pas, ma RichBox est vide, le curseur est à la 3eme ligne, mais le dessus est vierge :
Option Explicit
'
Const RTB_JAUNE As String = "\red255\green255\blue0"
Const RTB_ROUGE As String = "\red255\green0\blue0"
Const RTB_BLEU As String = "\red0\green0\blue255"
Const RTB_VERT As String = "\red0\green255\blue0"
Const RTB_VIOLET As String = "\red255\green0\blue255"
'
Private Sub Form_Load()
' clear
RichTextBox2.Text = vbNullString
Call AddRichLine(RTB_JAUNE & ";" & RTB_VERT & ";" & RTB_BLEU, "Ce qui suit est en \cf1 \i Vert Italique \f0 \cf0 \i0")
Call AddRichLine(RTB_JAUNE & ";" & RTB_VERT & ";" & RTB_BLEU, "\cf2Ma Nouvelle Ligne")
End Sub
'
Sub AddRichLine(sColor As String, sLine As String)
RichTextBox1.SelStart = Len(RichTextBox1.Text)
If LenB(RichTextBox1.Text) > 0 Then
RichTextBox2.SelText = vbCrLf
RichTextBox2.SelStart = Len(RichTextBox1.Text)
End If
RichTextBox1.SelRTF = "{\rtf1\ansi { \colortbl" & sColor & ";}" & sLine & "}"
End Sub