自动换行上的火灾事件

发布于 2024-08-24 03:37:41 字数 163 浏览 3 评论 0原文

有没有办法找出何时文本在 RichTextBox 中换行 (WordWrap)?我已经进行了相当多的挖掘,但到目前为止还没有找到任何东西,但我会继续寻找...

我正在研究这个的原因是因为每当 RichTextBox 将文本包装在末尾时我需要触发一个事件线。

谢谢大家

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

好菇凉咱不稀罕他 2024-08-31 03:37:41

从技术上讲,我相信使用 Windows API 可以实现这一点。查看 EM_SETHYPHENATEINFO 并在特别是传递自定义 HyphenateProc 的能力。这是一个指向函数的指针,当富文本框需要换行时调用该函数并调用您的函数来确定如何对单词进行连字符。

话虽如此,我真诚地怀疑这是否在 .NET 中公开,因此您需要进一步深入研究 API。但我认为这将是在每次换行时收到通知的最佳方式。

更新
在这里,我找到了一个博客帖子 更详细地讨论了这一点。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文