Jeff Johnson wrote:
I'm testing some 3rd-party software and I noticed that the
application doesn't remember which monitor it was last running on and
always opens on my primary monitor. This got me thinking that if I
were ever to write an app for widespread distribution, I'd want to go
the extra mile and add this funcrtionality to it to give it that
extra professional touch. So how do I do it? What class, if any,
would give me this kind of information? Do I have to use P/Invoke?
Normally, windows will remember, and if you use for example ultramon,
it works OK. My .NET application doesn't have any logic build in for
its main app location with multimonitor setups, but it starts up on the
monitor I closed it on, because windows takes care of that.
That's not true for child windows though. So if you have your main app
on monitor 2, and you open a dialog which is moved to monitor 1 by the
user, and you close the app, the dialog will be placed at monitor 2,
very likely (unless you choose the useless setting of letting windows
handle where the dialog pops up which is always not the location you
want it to be).
In that case, check out the DesktopBounds property of a form. :) Set
the saved DesktopBounds struct of a previous location it in the Load
event handler of the form and everything is good.
FB
--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website:
http://www.llblgen.com
My .NET blog:
http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------