简体   繁体   English

TMemo / TRichEdit有更多内存

[英]more memory for TMemo / TRichEdit

Is there any way to assign more memory for a Memo or RichEdit (if working with big files) 有什么办法可以为Memo或RichEdit分配更多的内存(如果使用大文件)

thanks 谢谢

Allocate memory with LocalAlloc and then give it to the edit control with the em_SetHandle message. 使用LocalAlloc分配内存,然后使用em_SetHandle消息将其分配给编辑控件。 You can handle the en_ErrSpace notification if the edit control requires more space. 如果编辑控件需要更多空间,则可以处理en_ErrSpace通知。 MSDN describes the process in the "About Edit Controls" article . MSDN在“关于编辑控件”一文中介绍了该过程。 It doesn't work on rich-edit controls, though; 但是,它不适用于富编辑控件。 they don't store their data in a contiguous buffer like edit controls do. 它们不会像编辑控件那样将数据存储在连续的缓冲区中。

Rather than load the whole file, wouldn't it be better to use the control as a 'window' to the data? 与其加载整个文件,不如将控件用作数据的“窗口”会更好吗? Just load your data in chunks, loading more (and getting rid of some) as the user scrolls up or down. 只需分块加载数据,然后随着用户上下滚动即可加载更多数据(并删除其中的一些数据)。

我建议切换到另一个编辑控件,例如SynEdit (它可以在几毫秒内加载80 mb的文本文件)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM