Delphi:每个控件之间的TFlowPanel边距
发布时间:2020-12-15 09:51:46 所属栏目:大数据 来源:网络整理
导读:我正在使用TFlowPanel,在运行时我正在创建一个可变数量的控件(在本例中为TButton). 我想在每个控件之间创建一个边距,但它还没有工作. procedure TForm1.FormCreate(Sender: TObject);var i: Integer; LButton: TButton;begin for i := 0 to 10 do begin LBut
我正在使用TFlowPanel,在运行时我正在创建一个可变数量的控件(在本例中为TButton).
我想在每个控件之间创建一个边距,但它还没有工作. procedure TForm1.FormCreate(Sender: TObject); var i: Integer; LButton: TButton; begin for i := 0 to 10 do begin LButton := TButton.Create(flwpnl1); // flwpnl1 is the TFlowPanel LButton.Parent := flwpnl1; LButton.Height := 20; LButton.Caption := Format('Status%d',[i]); LButton.Margins.Left := 20; LButton.Margins.Top := 20; LButton.Margins.Right := 20; LButton.Margins.Bottom := 20; end; end; 有什么想法吗? 问候和感谢, 解决方法
您需要将AlignWithMargins设置为true,因此在您的代码中将是:
LButton.AlignWithMargins := true; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |