00 Votes

Delphi/Lazaus: Center Application Window in the middle of the Screen

Question by Guest | 2014-04-06 at 15:16

I would like to achieve that the window of my application is appearing just centered in the middle of the screen.

For this, I am using the property TForm1.Position by setting it to poDesktopCenter.

I have made my program available on the Internet and one of the users of my application told me, that he is using two screens and my program is appearing just between the screens somewhere in the middle. Unfortunately, I cannot replicate this behavior because I am only using one screen.

Is it possible to keep the application window centered but prevent it from appearing in the middle of two screens? It would be good to center it on the first screen only.

1Best Answer1 Vote

Just set the property Form.Position to poDesktopCenter instead of poScreenCenter. Then it should also work for multiple screens.

With poDesktopCenter the application is set to the middle of the desktop. The taskbar does not belong to the desktop, but the desktop can span over multiple screens. The result is, that the program is appearing in the middle.

With poScreenCenter instead, the application is placed centered on the physical screen. And this is independent from tasbar or other screens.
2014-04-07 at 15:54

ReplyPositive Negative

Related Topics

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.


Ask your own question or write your own article on askingbox.com. That’s how it’s done.