Originally Posted by
ppl2pass
How can you make it so that users can change the colour of the highlighted text of richtextbox.
Basically users will highlight specific text in richtextbox and click on a button to open a colour dialogue.
Then that selected text will be the colour of the colour dialogue colour.
Drag 1 button, 1 colordialog component and a richtextbox to form.
Now double click the button and add the following:
Code:
If Not ColorDialog1.ShowDialog = Windows.Forms.DialogResult.Cancel Then
RichTextBox1.SelectionColor = ColorDialog1.Color
End If
If you want to change the back color of the selected text it is also possible and also font can be changed. And there are other functions too....Just play with them a bit and you'll master it. An example:
Code:
If Not ColorDialog1.ShowDialog = Windows.Forms.DialogResult.Cancel Then
RichTextBox1.SelectionColor = ColorDialog1.Color
RichTextBox1.SelectionFont = New Font("Verdana", 10, FontStyle.Bold)
RichTextBox1.SelectionBackColor = Color.LightBlue
RichTextBox1.SelectionBullet = True
RichTextBox1.SelectionIndent = 30
End If
Hope this helps