TLabel
的最大字符数为255(ShortString),但我还需要更多。我该怎么用?
答案 0 :(得分:11)
不,没有限制。我只是尝试使用一个包含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个字符。要构造一个更长的字符串,
使用字符串连接运算符(+
)来连接较短的字符串文字。