Delphi 属性 TMemo 行中字符串的最大长度
我一直在寻找 TMemo.Lines 中 String 的最大长度为 1024 的原因,但尚未找到。
我有一个文本文件,其中包含长度约为 2000 个字符的分隔/csv 数据。 在处理文件之前,我使用备忘录来预览它。
memo.Lines.LoadFromFile(textFile);
我已将 WordWrap 设置为 FALSE,并将滚动条设置为 ssHorizontal。因此任何记录都不会换行到下一行。
但是当我迭代 memo.Lines 时,我发现每个索引中保存的最大字符串是 1KB 或 1024 个字符。其余部分被截断到下一行。
但是,如果我使用 TStringList 加载文件,则当该行达到超过 1024 个字符时,该行不会被截断到下一个索引。当我使用 TRichEdit 时不会发生这种情况。
- 任何人都可以解释这个现象吗?
- 这是 TMemo 的默认行为吗?
我用D2006来尝试一下。
I've been searching the reason why the maximum length of String in a TMemo.Lines is 1024, but not found yet.
I have a text file which contains delimited / csv data which length is around 2000 characters.
I use a memo to preview it before I process the file.
memo.Lines.LoadFromFile(textFile);
I have set the WordWrap to FALSE, and scrollBar to ssHorizontal. So any record will not be wrapped to the next line.
But when I iterate the memo.Lines, I found that the maximum String hold in each index is 1KB or 1024 characters. The rest is truncated to the next line.
But if I use TStringList to load the file, the row is not truncated to the next index when it reaches more than 1024 characters. This is not happen when I use TRichEdit.
- Anyone can explain this phenomena?
- Is it the default behavior of TMemo?
I use D2006 to try this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
TeamB 在这个帖子上有一个答案:
https://forums.embarcadero.com/thread.jspa?threadID=14035
我很惊讶 TStringList 不适合你。我不太确定你的意思
我假设这些行是由换行符或 CRLF 分隔的。如果 CSV 行超过 1024 个字符,为什么会很重要?请发布更多详细信息。
There's a TeamB answer on this thread:
https://forums.embarcadero.com/thread.jspa?threadID=14035
I'm surprised that TStringList didn't work for you. I'm not quite sure what you mean by
I'm assuming the lines are delimited by newlines or CRLFs. Why would it matter if a CSV line exceeded 1024 characters? Please post more details.
WishKnew 尝试此链接
https://forums.embarcadero.com/thread.jspa?threadID= 14035
http://www.borlandtalk.com/line -length-in-tmemo-vt67596.html
http://groups.google.com/group/borland.public.delphi.vcl.components.using/browse_thread/thread/318fe3240d2860ba
正如伟大的彼得下面所说:
再见。
WishKnew try this links
https://forums.embarcadero.com/thread.jspa?threadID=14035
http://www.borlandtalk.com/line-length-in-tmemo-vt67596.html
http://groups.google.com/group/borland.public.delphi.vcl.components.using/browse_thread/thread/318fe3240d2860ba
As the great Peter Below says :
Bye.