Delphi, label max characters
TLabel
has its maximum characters 255(ShortString) but I need more than t开发者_如何学Pythonhat. What should I use?
No, there is no limit. I just tried to use a string with 1223 characters as the caption of a TLabel
, and that works. In code, however, a string literal cannot exceed 255 characters. But that is not a problem. Just do
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.';
You can make the caption as long as you wish, but a single string literal, the text in the source code between ' and ', cannot exceed 255 characters. To construct a longer string,
use the string concatenation operator (+
) to concatenate shorter string literals.
精彩评论