Reputation: 23187
I have a WinForm that mysteriously changes height seemingly randomly. Usually everything is evenly spaced, but sometimes when I look back at my form, it has a large margin under the bottom button.
screenshot: http://min.us/mv00PK
This is pretty weird, I'm not sure what's going on here, but I hate changing it back each time it happens. Whatever the case may be, I'm not manually changing the height so that gap is there, but could I be doing something else that causes this to happen?
Please let me know if you have an idea of what's happening here, thanks!
Upvotes: 0
Views: 159
Reputation: 273179
when I look back at my form, it has a large margin under the bottom button
There are about a dozen factors involved (FormBorderStyle, ScaleMode, FontSize, Anchors, Docking, ...).
You mentioned exactly 0 of them.
I'm not sure what's going on here
Neither are we.
Upvotes: 1
Reputation: 7198
Override or subscribe to the form size changed event, and set a breakpoint in it in the debugger. This will let you know what operation it is that causes the form to change size. From there, you should be able to debug it.
Upvotes: 0
Reputation: 12613
If you find the gap appearing consistently, yuo can consider setting the MaximumSize
property of the form to the desired size. That should prevent it from growing.
Upvotes: 0