DirectDrive
Programmer
I am trying to set up a form with a Rich Text Box that the user can select text and bold, underline, italics, and strike.
I have a sub that i call from each button. My problem is each time i set the FontStyle i loose the existing 1. i.e. if the selected text is bold and i hit the underline button it will clear the bold and underline.
How can i preserve the existing font style and apply a new one?
Case 4
txtM.SelectionFont = New Font(sFontName, iFontSize, FontStyle.Bold)
Case 5
txtM.SelectionFont = New Font(sFontName, iFontSize, FontStyle.Italic)
Case 6
txtM.SelectionFont = New Font(sFontName, iFontSize, FontStyle.Underline)
Case 7
txtM.SelectionFont = Font(sFontName, iFontSize, FontStyle.Strikeout)
Thanks.
I have a sub that i call from each button. My problem is each time i set the FontStyle i loose the existing 1. i.e. if the selected text is bold and i hit the underline button it will clear the bold and underline.
How can i preserve the existing font style and apply a new one?
Case 4
txtM.SelectionFont = New Font(sFontName, iFontSize, FontStyle.Bold)
Case 5
txtM.SelectionFont = New Font(sFontName, iFontSize, FontStyle.Italic)
Case 6
txtM.SelectionFont = New Font(sFontName, iFontSize, FontStyle.Underline)
Case 7
txtM.SelectionFont = Font(sFontName, iFontSize, FontStyle.Strikeout)
Thanks.