borderstyle := bsDialog also I wouldn't use the onactivate at all I think that calling setwindowlong from formcreate
So in OnFormCreate we get this effect (see 1st attachment)
2
howardpcI changed your code to the window size remains the same
MoveWindow(Handle, Left, Top, Width-1, Height + GetSystemMetrics(SM_CYCAPTION), True);=====================================
Update: problem solvedprocedure TForm1.FormCreate(Sender: TObject);
begin
Position:= poDesigned;
//warning: define form position here !!!
//Self.Left:= ...
//Self.Top:= ...
Label2.Caption:= Format('DesignTime Width = %d px', [Width]);
Label3.Caption:= Format('DesignTime Height = %d px', [Height]);
BorderStyle:= bsSizeable;
SetWindowLong(Handle, GWL_STYLE, GetWindowLong(Handle, GWL_STYLE) and (not WS_DLGFRAME));
with Constraints do
begin
MaxHeight:= Height - GetSystemMetrics(SM_CYCAPTION);
MinHeight:= Height - GetSystemMetrics(SM_CYCAPTION);
MaxWidth:= Width;
MinWidth:= Width;
end;
Label4.Caption:= Format('RunTime Width = %d px', [Width]);
Label5.Caption:= Format('RunTime Height = %d px', [Constraints.MaxHeight]);
end;
Thank you so much for your advice and comments
