我正在使用 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;
任何想法为什么?
问候和感谢,丹尼斯