TMemo max width

我与影子孤独终老i 提交于 2019-12-04 04:19:45

问题


Is there any way to make TMemo display text longer than 1024 into 1 line?
Take a look this simple code:

procedure TForm1.Button2Click(Sender: TObject);
var
    s: string;
    i: integer;
begin
    s := '';
    for i := 0 to 10000 do
      s := s + 'a';

    Memo1.Clear;
    Memo1.Lines.Add(s);
end;

The long text "s" will be displayed in multiple lines. The Memo1 will automatically wrap the text after 1024 characters.


回答1:


A TMemo is a wrapper for a native multi line edit control and is subject to the limitations it has. From INFO: Size Limits for a Multiline Edit Control:

A multiline edit control is also subject to the following limitations:

  • The maximum number of characters in a single line is 1024.
  • The maximum width of a line is 30,000 pixels.
  • The maximum number of lines is approximately 16,350.


来源:https://stackoverflow.com/questions/27188772/tmemo-max-width

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!