Delphi,标签最大字符数

标签 delphi label

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/

相关文章:

delphi - 为什么 D2010 中鼠标未移动时 OnMouseMove 会重复触发?

delphi - TGM map 访问被拒绝

python-3.x - Python 3+ Tkinter 中心标签文本

c# - GoTo 的可接受使用?

web-services - 如何在 Delphi 中处理安全 Web 服务的客户端身份验证?

c++ - 我如何使用他的 HWND 检查窗口是否有可见的滚动条?

Delphi 2010远程调试-无法使断点工作

Python Tkinter 从标签中删除/删除图像

python matplotlib 增加条形标签字体大小

.net - 如何在 .NET 中调整 MS 图表的 x 轴标签的位置?