views:

338

answers:

4

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?

A: 

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

PaulG
Yes, it is set to "GrowOnly", should I set it to "GrowAndShrink"?
Tom
A: 

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.

bufferz
+1  A: 

Sounds similar to this post. Don't know if you are having the same issue, but it's something to check out.

Stewbob
A: 

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.

Tom