Q: Saving window-settings on screen
iahtespam.grendel@epix.net (MacKinnon) wrote: I've learned that scary things can happen when trying to save form dimensions to the registry...for one, when a form is maximized or minimized, the left, right, width, and height tags are set as if the window really was that size, which can cause alot of havoc if one closes the program while minimized. I worked around this, eventually, at an ugly price...the form restores before closing... What I'd like to ask is, isn't there some property that stores the last known values for the dimensions, if the window is maximized or minimized? There must be something like this, since when you restore the form from either, it does go back where it was...I couldn't find any reference to this so far...at least with that, it'd be a simple matter of casing the windowstate when writing the keys, instead of all the hoops I have my programs jumping through now...
A: Before saving the form-size you check on the WindowState. So when it is not 0 you don't save the current size. That will start the application the next time with the last dimensions or (if there are none) with de design-dimensions. Return