WPF TextBox 和 RichTextBox 的组合
我正在编写一个基于 WPF (c#) TextBox 的小型编辑器。对于某些功能,仅在 TextBox 类中实现的方法 getRectFromCharacterIndex() 是必要的。此外,我必须在程序中进行一些语法突出显示。通常,这在 TextBlock 或 RichTextBox 中很容易处理。不幸的是,这两个控件不包括上面提到的方法。有谁知道如何通过一个小的解决方法在普通文本框中设置单个字符的格式和/或颜色?
非常感谢您的回答!
I am writing a small editor, based on a WPF (c#) TextBox. For some functionality the method getRectFromCharacterIndex(), which is only implemented in the TextBox-class is necessary. Furthermore I've got to do some syntax-highlighting in my program. Normally this is easy to handle in a TextBlock or a RichTextBox. Unfortunately these two Controls don't include Methods like the one mentioned above. Has anyone an idea, how to format and/or color single Characters in a normal TextBox with a small workaround?
Thank you very much for your answers!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我过去也做了同样的努力,我决定转向这个: http://wiki.sharpdevelop.net /AvalonEdit.ashx 几乎所有您需要的工作都在这里完成。
I did the same effort in the past and I decided to move to this: http://wiki.sharpdevelop.net/AvalonEdit.ashx almost all the work you need is done here.