Font to bold, italic, underline only

A

Adam Honek

Okay,

Assinging the font and its style (bold, italic etc.) using the font dialog
is easy such as:
FontDialog1.ShowDialog()

txtEmailBody.SelectionFont = FontDialog1.Font

But how does one change the selected text to bold, italic or underlined
without using the font dialog?

I've looked under .selectionfont and.selectedtext and can't see any way to
change it to bold, italic etc. All I see is a read-only property that tells
me if its bold, italic etc.

There's go to be a way. All these apps have these small B, I, U buttons.

Initialize a font, tweak it and assign it? Is that really the only way?

Thanks,

Adam
 
H

Herfried K. Wagner [MVP]

Adam Honek said:
Assinging the font and its style (bold, italic etc.) using the font dialog
is easy such as:
FontDialog1.ShowDialog()

txtEmailBody.SelectionFont = FontDialog1.Font

But how does one change the selected text to bold, italic or underlined
without using the font dialog?

I've looked under .selectionfont and.selectedtext and can't see any way to
change it to bold, italic etc. All I see is a read-only property that
tells me if its bold, italic etc.

Removing a certain font style:

\\\
EmailBody.SelectionFont = _
New Font( _
EmailBody.SelectionFont, _
EmailBody.SelectionFont.Style And Not FontStyle.Bold _
)
///

Adding a font style: '... = New Font(..., EmailBody.SelectionFont Or
FontStyle.Bold)'.
 
A

Adam Honek

Thanks, it worked and could equally do underline, italic the same way.
Thanks.

Adam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top