Delphi复制备忘录到Richedit问题
我在将备忘录的内容复制到 richedit 组件时遇到问题。
我以为会是
Richedit.text := memo.text;
但是如果我使用它,当备忘录文本换行到新的新行(不是 CR/LF)但只是换行时,Richedit 会开始一个新行。当备忘录开始新行时,richedit 也会开始新行,这很好。
任何人都知道如何将备忘录中的文本复制到 Richeditbox 中,当备忘录文本换行时,Richedit 中不会出现断行
谢谢
Colin
I am having a problem copying the contents of a memo to a richedit component.
I thought it would be
Richedit.text := memo.text;
However if I use this the Richedit starts a new line when the memo text wraps to a new a new line (not CR/LF) but just wrapping. The richedit also starts a new line when the memo starts a new line which is fine.
Anyone got any idea's how to copy the text from a memo into the richeditbox without the lines breaking in the Richedit when the memo text wraps
Thanks
Colin
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当我这样做时,
Memo1
的虚拟“换行符”不会神奇地转换为RichEdit
中的换行符 (CRLF),而且也不应该如此。这些“换行符”不存储在备忘录文本缓冲区中。事实上,Embarcadero 官方文档指出无论如何,另一种方法是这样做,
尽管这将保留虚拟换行符,如下所述。
更新
很可能您的代码中有一些其他奇怪的地方(错误),或者您以过于模糊的方式表达了您的问题。但是,要消除 VCL 包装器出现任何问题的风险,请尝试以下操作:
When I do
the virtual "line-breaks" of the
Memo1
are not magically converted to line-breaks (CRLF) in theRichEdit
, and they shouldn't be. These "line-breaks" are not stored in the memo text buffer. Indeed, the official Embarcadero documentation statesAnyhow, an alternative way is to do
although this will preserve the virtual line-breaks, as commented below.
Update
Most likely you have some other strangeness (bug) in your code, or you have phrased your question in a too vague manner. However, to eliminate the risk of any problem with the VCL wrappers, try this:
作为一个肮脏的黑客,你可以关闭备忘录上的自动换行,然后做作业,然后重新打开自动换行吗?这是一个令人讨厌的黑客行为,但如果有一些奇怪的行为,它可能会为你带来好处。
As a dirty hack, could you switch off word wrap on your memo then do the assignment and then switch word wrap back on? It's a nasty hack but it might do the trick for you if there is some odd behaviour.