我看不到你的问题。 当然,你必须确定纽芬兰人的立场,不仅是他们的规模。
procedure TForm1.Panel1Resize(Sender: TObject);
var
i: Integer;
btnWidth: integer;
begin
btnWidth := Panel1.Width div Panel1.ControlCount;
for i := 0 to Panel1.ControlCount - 1 do
begin
Panel1.Controls[i].Left := i * btnWidth;
Panel1.Controls[i].Width := btnWidth;
end;
end;
这一工作非常顺利。
见https://privat.rejbrand.se/panelresize.wmv。
OK,现在我看到。 我认为,<代码>alLeftis实际上是你的问题。 同样的控制往往改变其秩序。 这是众所周知的德尔菲诺。 而是如上。 有理由确保你按照正确的顺序走到各州。 如果你不能依赖<条码>第1号指示。 在每个工具栏目中设定<代码>Tag 财产(0,1,......)
procedure TForm1.Panel1Resize(Sender: TObject);
var
i: Integer;
btnWidth: integer;
begin
btnWidth := Panel1.Width div Panel1.ControlCount;
for i := 0 to Panel1.ControlCount - 1 do
begin
Panel1.Controls[i].Left := Panel1.Controls[i].Tag * btnWidth;
Panel1.Controls[i].Width := btnWidth;
end;
end;