Centering Form to Active Workbook

Add-in Express™ Support Service
That's what is more important than anything else

Centering Form to Active Workbook
How would you center a form to the active workbook? 
Chris Bishop




Posts: 13
Joined: 2016-01-25
Hi,

I am having trouble figuring this out. How would I go about centring a form to an active workbook?

I was thinking of getting the LEFT / TOP / WIDTH / HEIGHT of the active workbook and moving the form. Is there a better way using Delphi?
Posted 13 Apr, 2017 14:33:19 Top
Andrei Smolin


Add-in Express team


Posts: 14138
Joined: 2006-05-11
Hello Chris,

If you show your TForm modally, it should center itself if TForm.Position set to poOwnerFormCenter. If you chow it non-modally, set TForm.Position to poDefault, call GetActiveWindow() and calculate the position.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 14 Apr, 2017 07:08:49 Top