This is a migrated thread and some comments may be shown as answers.

Bold and Italic Text

1 Answer 173 Views
RichTextBox (obsolete as of Q3 2014 SP1)
This is a migrated thread and some comments may be shown as answers.
Joshua
Top achievements
Rank 1
Joshua asked on 17 Nov 2012, 01:32 AM
Hi,

I've noticed that you can check whether the selected font in the richtextbox is bold or italic, but not whether it is both bold and italic. Checking for bold or italic can be done likeso:

Dim style As StyleDefinition = SelectedEditor.CurrentEditingStyle
      Dim fontWeight As TextStyle = DirectCast(style.GetPropertyValue(Span.FontStyleProperty), TextStyle)
 
      btnFontBold.Checked = fontWeight = TextStyle.Bold
      If fontWeight = TextStyle.Bold Then
          btnFontBold.Checked = True
      ElseIf fontWeight = TextStyle.Italic Then
          btnFontItalic.Checked = True
      End If

However, I cannot seem to find a way to check for both bold and italic text, as the only members of TextStyle are Bold, Italic, and Regular. Is there a way to do this?

1 Answer, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 21 Nov 2012, 12:06 PM
Hi Joshua,

Thank you for writing.

Take a look at our documentation article about the CurrentSpanStyleChanged and CurrentParagraphStyleChanged event handling: http://www.telerik.com/help/winforms/richtextbox-getting-started.html. The last code snippet in the article demonstrates how you can perform the desired check.

Should you have any other questions, I will be glad to assist you.

Greetings,
Plamen
the Telerik team
Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
Tags
RichTextBox (obsolete as of Q3 2014 SP1)
Asked by
Joshua
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Share this question
or