-
how do i change the color of selected words? for example, when user wants to change the fontcolor into blue during his editing... the font will be blue starting from then... so that the texts that the user wrote before will stay the same but the new texts will be blue
-
You mean when using a RichTextBox? If so, the following should work.
Code:
RichTextBox1.SelColor = vbBlue
-
thanks for the reply... i guess it was only hard for me
-
to make it a little more interesting, how do i show the color palette if the user clicks a button?
-
Add the following code to a Form with a CommonDialog and a RichTextBox
Code:
Private Sub Command1_Click()
CommonDialog1.Color = RichTextBox1.SelColor
CommonDialog1.ShowColor
RichTextBox1.SelColor = CommonDialog1.Color
RichTextBox1.SetFocus
End Sub
-
Add a CommonDialog and name it Dialog. Now add this code to the command button:
Code:
Dialog.ShowColor
RichTextBox1.Selcolor = Dialog.Color