I am trying to get the character rect for all characters typed inside a richtextbox. Starting from the MyRichTextBox.Document.ContentStart textpointer, I advance every character using the following code
currentPointer = currentPointer.GetNextInsertionPosition(LogicalDirection.Forward)
And retrieve the "character" rect using the following code
currentPointer.GetCharacterRect(LogicalDirection.Forward)
But it looks like, for any textpointer returned from the piece of code above, the width of the rect is always 0. Now I am able to calculate the character rect based on the area between previous character rect and current character rect, but this causes a problem when a word wrap occurs.
Is there any way I can get a non-zero width from the GetCharacterRect() function of the rich text box ?
EDIT
The content from Microsoft here shows the same. Is anybody aware of an alternative to measure the character rect ?