How can I determine # of monitors and the resolution of each?

When exiting my program, I write the form's position (X, Y) (i.e. LEFT, TOP) to the registry, and read it when my form starts up next. A problem recently occurred in that if I change screen resolution between, opening the small form at its last position may be entirely "off screen" and hence opens it minimized (form does maximize - so it can't be placed in a viewable position).

So I need to make an adjustment or two (recommendations appreciated), but I need to know  if the (X, Y) stored falls inside the monitor(s') resolution(s).

TIA - Ed
LVL 3
Ed CovneyRetiredAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bipul4bCommented:
0
jimyXCommented:
To get the number of monitors:

Use "Screen.MonitorCount"    e.g. showmessage(inttostr(Screen.MonitorCount));

And to get the resolution of each monitor, use Width and height:
Screen.Monitors[0].Width  // 0 is the first monitor
Screen.Monitors[0].Height

My suggestion is to make a proportional adjustment to your form based on the resolution (if using the Anchor property is not sufficient).
For instance, if the Width x Height is 800x600 but your application default size is set to view 1366x768 then make proportional adjustment by altering the form and/or controls accordingly.

You may read this useful link.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ed CovneyRetiredAuthor Commented:
jimyX -

Thank you - This is exactly what I was hoping for !!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.