Reputation: 931
I'm setting form size to 0 and show it with code below:
Form overlay = new Form();
overlay.Size = new Size(0, 0);
overlay.Show();
But when the Form is shown, it's size is 140x39px. In constructor of overlay I set it size to 0. What can be the cause of this behaviour?
Upvotes: 0
Views: 224
Reputation: 250812
If you pass 0, the assumption is you don't care about the size and default sizes are calculated based on what needs to be displayed.
You can test this using:
Form overlay = new Form();
overlay.Size = new Size(100, 100);
overlay.Show();
If this size works, passing 0 may be equivalent to automatic.
Upvotes: 0
Reputation: 3615
You need to check the MaximumSize and MinimumSize properties on the Form. You are probably trying to set a size smaller than MinimumSize.
Upvotes: 4