Manual theory:
Use poMainFormCenter
when you want your form to be centered by the Application.MainForm
. The application main form is, in short, the first form you can see when you run your application, and you should consider that this main form can be on a different monitor than the active window from which you create and center a new form.
Or if you want to center your form by its Owner
, use the poOwnerFormCenter
which is IMHO better for user's experience because when you have more than two windows opened by each other, you can move the window to another monitor and create the new window on the monitor where user currently works on.
Practical usecase:
User ran your application on the 1st monitor. The application created the Form2
from its MainForm
. User moved that Form2
on the 2nd monitor and from there pressed the button which created another form, Form3
.
If you designed your Form3
to use the poMainFormCenter
position, the Form3
will be centered by the MainForm
which is at this time on a different monitor, what is IMHO confusing.
If you would use code like this for creating and showing Form3
:
procedure TForm2.Button1Click(Sender: TObject);
begin
// the Owner parameter Self (or Form2 here) in the Form3 constructor along
// with the Position set to poOwnerFormCenter will ensure you that the form
// will be centered by the current form position, so on the current monitor
// where the user works on as well
Form3 := TForm3.Create(Self);
try
Form3.Position := poOwnerFormCenter;
Form3.ShowModal;
finally
Form3.Free;
end;
end;
You will get Form3
centered by the Form2
but mainly on the same monitor as the Form2
currently lies on, as you currently work on: