Loading a form on the same screen / monitor as main form?
Hi there folks. I was getting into extended monitor set ups, and had a program written years ago with lots of forms. I was wondering, if I wanted to run a program on screen 2, and then have all forms run on screen 2, is there a code that tells the program to run on the same screen as the main form?
Thanks!
Re: Loading a form on the same screen / monitor as main form?
Where on the monitor?
The easiest way is probably to use StartupPosition = CenterOwner and of course assign the owner when the parent Form calls Load.
But a lot of people write pachinko machine programs where a raft of Forms have no hierarchical relationships, so that won't help.
You can also assign Left and Top of the loaded Form to that of the current Form before calling Load.
Or to get fancier than that you can always look at the many threads here on enumerating the list of monitors and their attributes,.
Re: Loading a form on the same screen / monitor as main form?
Here's stuff I've written to do this type of thing. It's not exactly what you asked for, but all the tools are there to get it done.
Re: Loading a form on the same screen / monitor as main form?
There is an API that will tell you which "device" a pointer or form is located. However, the easiest way would be to start any "virgin window" in the middle of your own programs RECT location.