How can i change the font and fontsize in a RichTextBox???
Printable View
How can i change the font and fontsize in a RichTextBox???
Use the SelFontName and SelFontSize Properties after selecting the Text you want to alter with the SelStart and SelLength Properties.
RichEdit1.selfontname = "Times New Roman"
RichEdit1.selfontsize = 10
If you want all the font of the entire box to be the same do
'Highlight all text
RichEdit1.SelStart = 1
RichEdit1.selLength = len(RichEdit.Text)
'Set font properties
RichEdit1.SelFontName = "Times New Roman"
RichEdit1.SelFontSize = 10
'UnSelect all text
RichEdit1.SelLength = 0
Check out SelFontName. Try this. Add a RichTextBox and a ListBox to your form:
Selecting the FontName in the ListBox will change the font in the RichTextBox.Code:Private Sub Form_Load()
Dim i As Integer
For i = 0 To Screen.FontCount - 1
List1.AddItem Screen.Fonts(i)
Next
End Sub
Private Sub List1_Click()
RichTextBox1.SelFontName = List1.List(List1.ListIndex)
End Sub
Wow, 3 replies in 4 min...
Thanks for the quick replies!!! : o )))
Edited by CyberCarsten on 03-08-2000 at 05:25 PM