Topic: Can a form be centred on screen without it jumping
I have a form which has constraints as to maximum height and width when the maximise button is clicked.
I have the following code to make sure the form stays centred on the screen when maximised.
procedure Form1_OnResize (Sender: TObject);
begin
form1.Left := (screen.Width - form1.width) div 2;
form1.Top := (screen.Height - form1.Height) div 2;
end;
The problem with this is that the form visibly jumps between the top left corner and the final resting place as per the code above. Does anyone have any ideas to workaround this and make the screen centering more smooth?
My default form settings are:
Position = poMainFormCentre
Width = 952
Height = 461
MaxHeight = 750
MaxWidth = 1500
Min height and width is zero