HilemonC
April 23rd, 2003, 11:30 AM
This has to be simple, but it's giving me fits...
At start up, I want my main application form to remember its position, size, and state (normal, maximized, or minimized) from the previous execution. I have created event handlers for Closing and Load, and it almost works.
Here's the problem scenario: The application is in the maximized state when closed. At the next start up, the application is maximized, BUT when I click on the restore/normal box, the form remains full screen. The cause of this is that the form's Location and Size properties were changed when the maximize box was clicked during the first execution, and those values are what I output in my Closing handler.
I have found no reliable way to get the normal/restored position and size while in the Maximized state, and if I set the WindowState to Normal during the Close handler, the Size property is updated but not the Location. There is a member variable of Form called restoredWindowBounds. However, it is apparently Private because I cannot access it (other than in the debugger).
Any ideas? It feels like I'm making this WAY too hard.
Regards,
Chris Hilemon
At start up, I want my main application form to remember its position, size, and state (normal, maximized, or minimized) from the previous execution. I have created event handlers for Closing and Load, and it almost works.
Here's the problem scenario: The application is in the maximized state when closed. At the next start up, the application is maximized, BUT when I click on the restore/normal box, the form remains full screen. The cause of this is that the form's Location and Size properties were changed when the maximize box was clicked during the first execution, and those values are what I output in my Closing handler.
I have found no reliable way to get the normal/restored position and size while in the Maximized state, and if I set the WindowState to Normal during the Close handler, the Size property is updated but not the Location. There is a member variable of Form called restoredWindowBounds. However, it is apparently Private because I cannot access it (other than in the debugger).
Any ideas? It feels like I'm making this WAY too hard.
Regards,
Chris Hilemon