TLabel
的最大字符数为 255(ShortString),但我需要更多。我应该使用什么?
最佳答案
不,没有限制。我只是尝试使用一个包含 1223 个字符的字符串作为 TLabel
的标题,这很有效。 在代码中,字符串文字不能超过 255 个字符。但这不是问题。就这么做
Label1.Caption := 'This is a test. This is a test. This is a test.' +
'This is a test. This is a test. This is a test. This is a test.' +
'This is a test. This is a test. This is a test. This is a test.' +
'This is a test. This is a test. This is a test. This is a test.' +
'This is a test. This is a test. This is a test. This is a test.' +
'This is a test. This is a test. This is a test. This is a test.' +
'This is a test. This is a test. This is a test. This is a test.';
您可以根据需要制作标题,但单个字符串文字(源代码中 ' 和 ' 之间的文本)不能超过 255 个字符。要构造更长的字符串,
使用字符串连接运算符 (+
) 连接较短的字符串文字。
关于Delphi,标签最大字符数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5922901/