You have to combine the new FontStyle with the existing FontStyle in bitwise fashion: Code:
Private Sub ApplyBoldStyle()
Me.RichTextBox1.SelectionFont = New Font(Me.RichTextBox1.SelectionFont, _
Me.RichTextBox1.SelectionFont.Style Or FontStyle.Bold)
End Sub
Private Sub RemoveBoldStyle()
Me.RichTextBox1.SelectionFont = New Font(Me.RichTextBox1.SelectionFont, _
Me.RichTextBox1.SelectionFont.Style And Not FontStyle.Bold)
End Sub
Private Sub ToggleBoldStyle()
Me.RichTextBox1.SelectionFont = New Font(Me.RichTextBox1.SelectionFont, _
Me.RichTextBox1.SelectionFont.Style Xor FontStyle.Bold)
End Sub
Bookmarks