Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fire event on Word-Wrap

Is there some way to find out when the text gets wrapped (WordWrap) inside a RichTextBox? I've dug around quite a bit but haven't found anything so far, will keep looking though...

The reason I'm looking into this is because I need an event to fire whenever the RichTextBox wraps the text at the end of the line.

Thank you all


1 Answers

Technically I believe this is possible with the Windows API. Take a look at EM_SETHYPHENATEINFO and in particular, the ability to pass a custom HyphenateProc. This is a pointer to a function that is called when the rich text box needs to wrap a line and calls your function to determine how to hyphenate the word.

Having said that, I sincerely doubt this is exposed in .NET so you would need to dig into the API a bit more. But I think this would be the best way of being notified on each line wrap.

UPDATE
Here you go I found a blog post that talks about this in a bit more detail.

like image 94
Josh Avatar answered Apr 19 '26 19:04

Josh