问题
I have simple form TForm1 with 2 panels. First with Align := alLeft and second with Align := alClient and empty frame TFrame1. When i add following procedures to the form, everything works without problems.
procedure TForm1.FormCreate(Sender: TObject);
var
lFrame1, lFrame2 : TFrame1;
begin
lFrame1 := TFrame1.Create(nil);
lFrame1.Parent := pnl1;
lFrame1.Align := alClient;
lFrame2 := TFrame1.Create(nil);
lFrame2.Parent := pnl2;
lFrame2.Align := alClient;
end;
procedure TForm1.FormResize(Sender: TObject);
begin
pnl1.Width := ClientWidth div 2;
end;
But when I set Constrains for TFrame1, for example TFrame1.Contraints.MinWidth := 100 and maximize and restore the form, then the form won't return to its previous state. Regardless of frame size, form size or constrains values, it always ends the same way. In my case default form has 300 width and after maximize and restore it ends with 1062. However without Constraints or FormResize it works. Can someone explain this strange behavior?
来源:https://stackoverflow.com/questions/43201919/resizing-frames-with-width-constraints