Disparition des carcteres d'un RichEditBox

Résolu
cs_andrebernard Messages postés 404 Date d'inscription lundi 9 juin 2003 Statut Membre Dernière intervention 4 septembre 2013 - 3 sept. 2007 à 17:26
cs_andrebernard Messages postés 404 Date d'inscription lundi 9 juin 2003 Statut Membre Dernière intervention 4 septembre 2013 - 4 sept. 2007 à 09:09
Bonjour à tous

Je voudrais faire un richeditbox dans lequel les caracteres varie selon la taille de la fenetre qui le contient.
ça marche tres bien mais quand je resize la fenetre le texte que j'avais ecris en vert redeviens noir et donc disparait sur mon fond noir

Private Sub Form_Load()
 RichTextBox1.Width = Form1.Width
 RichTextBox1.Height = Form1.Height
End Sub



Private Sub Form_Resize()
 RichTextBox1.Font.Size = Int(Form1.Width / 400)
 RichTextBox1.Width = Form1.Width
 RichTextBox1.Height = Form1.Height
 RichTextBox1.SelColor = &HC000&
End Sub


Je n'ai pas compris pourquoi

Merci et bonne journée

2 réponses

cs_casy Messages postés 7741 Date d'inscription mercredi 1 septembre 2004 Statut Membre Dernière intervention 24 septembre 2014 40
3 sept. 2007 à 19:45
Essaye ceci :

Private Sub Form_Resize()
RichTextBox1.Font.Size = Int(Form1.Width / 400)
RichTextBox1.Width = Form1.Width
RichTextBox1.Height = Form1.Height
RichTextBox1.SelStart = 0
RichTextBox1.SelLength = Len(RichTextBox1.Text)
RichTextBox1.SelColor = &HC000&
RichTextBox1.SelLength = 0
End Sub<hr />
, ----
[code.aspx?ID=41455 By Renfield]

---- Sevyc64  (alias Casy) ---- <hr size ="2" width="100%" /># LE PARTAGE EST NOTRE FORCE #    http://aide-office-vba.monforum.com/index.php
3
cs_andrebernard Messages postés 404 Date d'inscription lundi 9 juin 2003 Statut Membre Dernière intervention 4 septembre 2013 1
4 sept. 2007 à 09:09
Bonjour CASY

Merci ça marche nickel.
Par contre j'avais encore un petit soucis, c'est que du coup quand on resizait la fenetre le curseur se remttait au debut et ne gardait pas sa place d'origine.

Grace à ton code que j'ai compris, j' ai un peu modifié pour que le curseur reste ou il est

Merci beaucoup

Private Sub Form_Resize()
 rtf.Font.Size = Int(frmDoc.Width / 400)
 rtf.Width = frmDoc.Width
 rtf.Height = frmDoc.Height
 rtf.SelStart = 0
 rtf.SelLength = Len(rtf.Text)
 rtf.SelColor = &HC000&
 rtf.SelStart = Len(rtf.Text)
End Sub
3
Rejoignez-nous