RichText Font Change



Want to change font size for whole text in a RichTextBox

RichText.Filename=Name$ ' inputs text
' font size =10

RichText.SelLength=len(RichText.TextRTF) ' highlights all
RichText.Font.Size =12
RichText.SelLength=0

changes font size only up to the position where an attribute
like Underline or Bold is loacted within RTFtext,
how can this be fixed ?
MM070398Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jbilCommented:
RichText.SelFontSize = 12

instead of

RichText.Font.Size =12


0
MattiCommented:
Hi!

Best is use StdFont object it is simplest and fastest if you wan't it globaly in that rtf box.

Try this sample:

here are two command buttons for the test and one rtf box on a form.
Option Explicit


Dim myfont As New StdFont
'Need declare this

Private Sub Command1_Click()
myfont.Size = 10
Set RichTextBox1.Font = myfont
End Sub

Private Sub Command2_Click()
myfont.Size = 16
Set RichTextBox1.Font = myfont
End Sub

Private Sub Form_Load()
myfont.Bold = False
myfont.Name = "Arial"
myfont.Size = 10 ' A defaul font size in here
End Sub

Matti
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MattiCommented:
Hi!

I think this problem a litle moore
and what if it is not the font is not the first matter in here.

Someting extra comes to my mind if you try to use clipboard data e.g Word 97 / 2000 documet. Then there is bossible that some format options like division into paragraphs e.g and that might need a filter control.

Another rtf box will do this.

Bring the documet to this second unvisible rtf box, and move it to other rtf box as text.

RichTextBox1.Text = RichTextBox2.Text

This will remove those special format options and the font conversion might get solved successful.

Matti
0
MM070398Author Commented:
RichText.SelFontSize = 12

instead of

RichText.Font.Size =12

from jbil works also
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Fonts Typography

From novice to tech pro — start learning today.