Form.Size is not visible in ApplicationSettings->PropertyBinding
I want to save form po开发者_高级运维sition. I have successfully set Form.Location property in ApplicationSettings->PropertyBinding but Form.Size is not listed in property binding list. Why? Do I need to add this property to save properties list using code?
The Form class overrides the Size property to prevent it from getting saved. This is by design, it uses the ClientSize instead so that the size doesn't depend on the border width chosen by the user. You'll find ClientSize in the property binding list.
This is still not a good idea, you don't want to save the size if the window is minimized or maximized. It will not restore properly. Instead, override the OnResizeEnd() method and only save the size if the WindowState is Normal.
精彩评论