如何让richedit不选择或突出显示?
帮助我知道 Richedit 无法突出显示/禁用突出显示或文本选择?同时删除光标位置。该应用程序仅用于显示 rtf 文本而不是编辑,因此我不需要这些功能。在德尔福
help i wnted the richedit cannot be highlighted/ disable the hightlight or selection of text? also remove the cursor pos. the application is intended for display only the rtf text and not editing so i dont need those features. in delphi
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以将
SelLength
属性设置为0 在OnSelectionChange
事件中you can set the
SelLength
property to 0 in theOnSelectionChange
event只是为了澄清 - 您肯定需要丰富的文本功能,例如颜色、大小等?并且您肯定希望禁止从您的控件中进行复制&粘贴到其他地方吗?真的是这样吗?
我建议您重写 TRichEdit 中的 OnMouseUp、OnSaveCLipboard、OnSelectionChange 以及继承的方法 GetSelTextBuf、CopyToClipboard、CutToClipboard、SelectAll .. 也许还有 Repaint、Update 等。
确定您想要什么 - 如果您可以在没有富文本功能的情况下生活,那么只需使用一些 TLabel 并以编程方式编写文本即可。
如果您必须拥有富文本,我会看到一些选择 - 为您的组件编写大量偶数处理程序,或者创建您自己的从 TRichEdit 派生的组件,这使得更容易在一个表单上拥有多个组件,或者查看像 Tori's 之类的网站看看其他人是否已经制作了这样的组件。
祝你好运。
Just to clarify - you definitely need rich text features, like color, size, etc? And you definitely want to forbid copy from your control & paste somewhere else? Is that it exactly?
I would suggest that you override OnMouseUp, OnSaveCLipboard, OnSelectionChange from TRichEdit and the inherited methods GetSelTextBuf, CopyToClipboard, CutToClipboard, SelectAll .. maybe Repaint, Update and a few more.
Be sure of what you want - if you can live without rich text features, then just use some TLabels and write the text programatically.
If you must have rich text I see a few choices - write a lot of even handlers for your componet, or create your own component derived from TRichEdit, which makes it easier to have sevaral of them on one form, or look at sites like Tori's and see if someone else already made such acomponent.
Good luck.
您可以将 RichEdit 的 readonly 属性设置为 true - 这可以防止击键等。
You could set the readonly property of the RichEdit to be true - this prevents keystrokes, etc.
您可以简单地禁用 RichEdit 以防止文本选择并隐藏文本光标:
You can simply disable the RichEdit to prevent text selection and to hide the text cursor: