delphi - 为什么TEdit只显示长度等于或小于37440个字符的文本?

标签 delphi user-controls delphi-6

如果你这样做:

  Edit1.Text := StringOfChar('X', 37440);

它将显示文本,但是如果您这样做:

  Edit1.Text := StringOfChar('X', 37441);

文本不会出现。

有人知道为什么吗?
如果这是一个错误,除了将所有现有组件替换为 TMemo 之外,还有另一种调整方法吗?
到底为什么是 37440?

最佳答案

从表面上看,您应该能够使用 EM_LIMITTEXT 来控制它消息:

The EM_LIMITTEXT message limits only the text the user can enter. It does not affect any text already in the edit control when the message is sent, nor does it affect the length of the text copied to the edit control by the WM_SETTEXT message. If an application uses the WM_SETTEXT message to place more text into an edit control than is specified in the EM_LIMITTEXT message, the user can edit the entire contents of the edit control.

Before EM_LIMITTEXT is called, the default limit for the amount of text a user can enter in an edit control is 32,767 characters.

此消息由 TEditMaxLength 属性公开。

但是,将 MaxLength 设置为较大的值似乎没有帮助。我无法说服单行编辑控件显示大量字符。

我怀疑您唯一可行的选择是使用多行编辑控件,即 TMemo

我确信 MS 会争辩说,单行编辑控件的设计目的不是容纳数千个字符,因此他们没有动力让该控件变得更强大。

FWIW,使用 Unicode 版本的控件,截止值似乎是 37444 而不是 37440!

关于delphi - 为什么TEdit只显示长度等于或小于37440个字符的文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17476973/

相关文章:

delphi - 在 Delphi XE2 中使用 JclCompression 从 ZIP 存档中删除文件

Delphi - IDE 插件/扩展,用于在单元之间复制/移动组件和相关事件代码

asp.net - 动态地将用户控件添加到转发器

asp.net - 在母版页中包含 Javascript 和 css,在 asp.net 中包含用户控件

.net - 从子用户控件获取父用户控件中的属性值

delphi - 在 Windows 7 64 位上运行的 Delphi 6 中找不到代码资源管理器窗口。如何取回?

delphi - 使用按角色过滤的 View Firebird

sql-server - 最近 Delphi TADOStoredProc/D6 和 RAD Studio XE2 上的故障

delphi - 在 Delphi 7 中的 TIdHTTPServer 中处理 PUT 和 DELETE 请求