I have a Windows Forms application with a normal window. Now when I close the application and restart it, I want that the main window appears at the same location on my screen with the same size of the moment when it was closed.
Is there an easy way in Windows Forms to remember the screen location and window size (and if possible the window state) or does everything have to be done by hand?
Best Answer
If you add this code to your
FormClosing
event handler:It will save the current state.
Then add this code to your form's
OnLoad
handler:It will restore the last state.
It even remembers which monitor in a multi monitor set up the application was maximised to.