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.
Related Topics
Lord's Prayer in 20 other Languages
Info | 0 Comments
MIME Types of Microsoft Office File Formats
Info | 0 Comments
Android Splash Screen Tutorial
Tutorial | 0 Comments
HTML5 Canvas: Center Text on Point horizontally and vertically
Tutorial | 0 Comments
Delphi: GetCursorPos problem on Windows 8.1 with scaling
Open Question | 1 Answer
How to get rid of annoying telemarketing calls once and for all
Tip | 0 Comments
Lazarus/Delphi: Width and ClientWidth - Difference
Info | 0 Comments
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.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
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