Visual Studio keeps resizing my form without me telling it to, help! [duplicate]

纵饮孤独 提交于 2020-01-13 03:26:43

问题


I am running visual studio 2008. Every so often when I go to the designer view of one of my forms, the designer will make the form slightly larger. This happens on forms where I have a minimum size. I want the form to be the minimum size so why does it keep adjusting the size on me?


回答1:


I was having this issue with a particular form that hosted a user control. Everytime I did a full Rebuild Solution it would make the form shorter. Found a simple solution: in the designer, set the minimum size property of the form to be the same as the size property. Now when the designer messes around trying to change the size it will end up as the minimum size - which is the size you actually want.




回答2:


Have you checked AutoSizeMode on the form? Is the form inherited from a base form?




回答3:


This solution might not be ideal, but I've had problems with the designer taking on a life of its own and this worked for me.

Subscribe to your forms Resize event either in the designer or constructor, and in the function call this.Size = this.MinimumSize.

This will have an effect on the way the designer behaves too, VS must precompile some events for the designer or something.



来源:https://stackoverflow.com/questions/1159937/visual-studio-keeps-resizing-my-form-without-me-telling-it-to-help

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!