Bold and Italic Text

2 posts, 0 answers
  1. Joshua
    Joshua avatar
    1 posts
    Member since:
    Nov 2012

    Posted 16 Nov 2012 Link to this post


    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?
  2. Plamen
    Plamen avatar
    132 posts

    Posted 21 Nov 2012 Link to this post

    Hi Joshua,

    Thank you for writing.

    Take a look at our documentation article about the CurrentSpanStyleChanged and CurrentParagraphStyleChanged event handling: 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.

    the Telerik team
    Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
  3. DevCraft banner
Back to Top