raym0nd
raym0nd

Reputation: 3262

RichTextBox C# Draw Text method?

Whats the method that draws the text in a richTextBox ? I tried overriding OnRender() but this is only called when I initialize richTextBox not when I'm typing. I dont want to call OnSelectionChange Or OnTextChange. I need the method that draws the text.

Im using this RichtextBox the Windows.Controls

EDIT

My RichTextBox contains words separated by image separators. I want to Use the OnDraw method or any to create a rectangle to add an adorner image on top of each word.

Upvotes: 0

Views: 1295

Answers (1)

Ed Bayiates
Ed Bayiates

Reputation: 11230

There isn't a method that draws text. WPF RichTextBox holds FlowDocuments, which are closely related to XPS. They are rendered in the same way WPF is.

Edit: Use the methods described here to get the position of text and add adorners.

Edit 2: Use this technique to get character positions.

Rect rect = base.GetRectFromCharacterIndex( idx );

Upvotes: 1

Related Questions