Store Program Coordinates

  • Thread starter Thread starter Derek Hart
  • Start date Start date
D

Derek Hart

I am storing the top, left, height and width coordinates of a winforms
application when the user exits the application, so it loads the same way
next time. If the user moves the application to the bottom right and sizes
it small, or even has multiple monitors set up and moves the application to
the next monitor, the application may come back and not be found. The user
can right click on the taskbar and choose to size it, which allows it to be
pulled back onto the screen, but that is not intuitive. Is there a clever
way to compare the top and left coordinates that I store in the registry,
and determine if those can be visible on screen? Then I could reset it.
 
Why not just store the windows form size and always show it center screen?
-you will never run into an issue of the form being opened 'off' the screen
and the user looks for it.

You may be opening up a can of worms trying to always open it up in the same
spot like this.

Miro
 
I am storing the top, left, height and width coordinates of a winforms
application when the user exits the application, so it loads the same way
next time. If the user moves the application to the bottom right and sizes
it small, or even has multiple monitors set up and moves the application to
the next monitor, the application may come back and not be found. The user
can right click on the taskbar and choose to size it, which allows it to be
pulled back onto the screen, but that is not intuitive. Is there a clever
way to compare the top and left coordinates that I store in the registry,
and determine if those can be visible on screen? Then I could reset it.

Look at System.Windows.Forms.Screen. There are methods there that
will let you determine which monitor a form is on (if any) and the
co-ordinates of all monitors.
 
Miro said:
Why not just store the windows form size and always show it center screen?
-you will never run into an issue of the form being opened 'off' the
screen and the user looks for it.

You may be opening up a can of worms trying to always open it up in the
same spot like this.

Miro

But the title bar, edges and controls may be off the screen if the
resolution has changed. I think that testing the size vesus the screen and
potentially scaling will work well.
 
Back
Top