tlabel的行间距
A TLabel Delphi component has a WordWrap property you can set to true in order for the text in the Caption property appear wrapped (multi-lined) when it is too long for the width of the label.
TLabel Delphi组件具有WordWrap属性,可以将其设置为true,以使Caption属性中的文本对于标签的宽度而言过长时显示为自动换行(多行)。
What's more, at run-time, you can use the next assignment to specify multiple lines of text for a Label:
此外,在运行时,您可以使用下一个分配为Label指定多行文本:
Label1.Caption := 'First line' + #13#10 + '
However, you *cannot* specify multi-line text for a TLabel at design-time, using Object Inspector.
但是,您不能在设计时使用对象检查器为TLabel指定多行文本。
使用说明 ( Instructions )
One trick to add more lines of text for a Caption property of a TLabel, at design time, is to edit the Form's .DFM file directly. Here's how:
在设计时,为TLabel的Caption属性添加更多文本行的一种技巧是直接编辑表单的.DFM文件。 这是如何做:
- Drop a TLabel on a Form 将TLabel放到表单上
- Right click the Form to activate the popup menu 右键单击表单以激活弹出菜单
- Select "View As Text" 选择“查看为文本”
- Locate the "object Label1:TLabel" section 找到“对象Label1:TLabel”部分
- Change the line "Caption = 'Label1'" to: 将行“标题='Label1'”更改为:
- Caption = 'Label1' + #13#10 + 'Second line' 标题='Label1'+#13#10 +'第二行'
- Right click the code to activate the popup, again 再次右键单击代码以激活弹出窗口
- Select "View As Form" 选择“以表单查看”
Job done! TLabel with multiple lines of text, at design-time!
翻译自: https://www.thoughtco.com/setting-multi-line-caption-for-tlabel-1057575
tlabel的行间距