RichTextBox SelectionFont Issue

  • Thread starter Thread starter InvestecLondonDevelopers
  • Start date Start date
I

InvestecLondonDevelopers

When you select text in the RTF editor (C# code) that has different styles
of font (i.e. part of the test is bolded and part is underlined) the
selectionfont property is set to null.

Is there any other way we can access all the available style for the
selected text?

Thanks

Joseph
 
You could create a new RichTextBox, then set its Rtf property equal to the
SelectedRtf property of your original RichTextBox. Then you can select one
character at a time from the new RichTextBox and check the SelectionFont.
Be warned, though - this will probably be slow for large selections.

I believe there are also some API calls that could accomplish this faster.
Check the MSDN for more info.

Brian Davis
www.knowdotnet.com
 
Back
Top