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

允我心安 提交于 2019-12-04 12:54:18

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.

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

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.

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