Firemonkey 还是很新的。有一个组件,我要添加到一个从 TRectangle 下降的表单中。一旦我画出来,我想在其中添加文本,但我真的很难找到任何文档如何做到这一点。任何人都可以提出任何建议或指出我正确的方向吗?
谢谢
为了建立在 DSM 的评论之上,这是一个如何在代码中将 TLabel 添加到 TRectangle(或 TRectangle 后代)的示例:
var
MyLabel: TLabel;
begin
// Create a TLabel and add it to an existing TRectangle
MyLabel := TLabel.Create(MyRectangle);
// Set the Parent to MyRectangle
MyLabel.Parent := MyRectangle;
// Align the TLabel in the center of the TRectangle
MyLabel.Align := TAlignLayout.Center;
// Center align the text in the TLabel
MyLabel.TextAlign := TTextAlign.Center;
// Set the text for the label
MyLabel.Text := 'Test Label';
end;
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句