【问题标题】:Delphi: TFlowPanel margins between each controlDelphi:每个控件之间的 TFlowPanel 边距
【发布时间】:2017-08-05 22:33:50
【问题描述】:

我正在使用 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;

有什么想法吗?

问候和感谢, 丹尼斯

【问题讨论】:

  • LButton.AlignWithMargins:=True;?
  • 真丢脸!当然......这对我有用。非常感谢。

标签: delphi controls margin flowpanel


【解决方案1】:

您需要将 AlignWithMargins 设置为 true,因此在您的代码中:

LButton.AlignWithMargins := true;

【讨论】:

    猜你喜欢
    • 2015-03-17
    • 1970-01-01
    • 1970-01-01
    • 2020-01-04
    • 2021-03-24
    • 2013-09-05
    • 1970-01-01
    • 1970-01-01
    • 2020-02-23
    相关资源
    最近更新 更多