shadow1779
Messages postés706Date d'inscriptionmercredi 17 novembre 2004StatutMembreDernière intervention29 septembre 2013
-
23 mars 2006 à 18:35
Dalida
Messages postés6728Date d'inscriptionmardi 14 mai 2002StatutContributeurDernière intervention11 janvier 2016
-
23 mars 2006 à 19:21
bonjour,
je me posais une petite question, comment on peut faire avec le framework afin de colorer du texte, je m'explique, je fais une richtextbox, comment dire
MaTextBox.Text = "ce texte dois etre en noir , et après cette virgule ce texte doit etre en bleu"
Dalida
Messages postés6728Date d'inscriptionmardi 14 mai 2002StatutContributeurDernière intervention11 janvier 2016 23 mars 2006 à 18:48
salut,
je te propose la réponse de la MSDN :
Public Sub ChangeMySelectionColor()
Dim colorDialog1 As New ColorDialog()
' Set the initial color of the dialog to the current text color.
colorDialog1.Color = richTextBox1.SelectionColor
' Determine if the user clicked OK in the dialog and that the color has
' changed.
If (colorDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK) _
And Not(colorDialog1.Color.Equals(richTextBox1.SelectionColor)) Then
' Change the selection color to the user specified color.
richTextBox1.SelectionColor = colorDialog1.Color
End If
End Sub
ou grâce à une recherche sur le site !
[ Dalida ]<hr> pensez à indiquer le langage utilisé et sa version !
Dalida
Messages postés6728Date d'inscriptionmardi 14 mai 2002StatutContributeurDernière intervention11 janvier 2016 23 mars 2006 à 19:21
ha oui !
tu auras remarqué que c'est la couleur de la sélection qui est modifiée, il faut donc au préalable définir le texte sélectionné. SelectionStart pour définir la position de départ et SelectionLenght pour...
...sa longueur !
une fois la sélection définie tu peux utiliser la méthode de la MSDN.
[ Dalida ]
<HR>
pensez à indiquer le langage utilisé et sa version !