开发者

Delphi, label max characters

开发者 https://www.devze.com 2023-03-03 09:57 出处:网络
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 capti

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号