I have a C# form with a sizable border. I'd like to set the minimum size to (850, 760) (the default starting size), but when I try to set the value in the form properties menu it keeps changing it to (850, 720). I tried setting it by code as follows:
this.minimumSize = new System.Drawing.Size(850, 760);
but when I run the code I can still shrink my form vertically. Does anyone have any ideas as to what the problem might be?
EDIT: I'm using two monitors, one standard 1280x1024 and the other widescreen 1366x768, could that be the problem? In that case is there some way to test the user's monitor resolution and set the minimum size based on that?
A lot of the code that runs at runtime is active at design time as well. That gives the Winforms designer a very nice WYSIWYG user interface, but it does have some unfortunate side-effects. Including crashing the designer and giving you the White Screen of Darn. Or crashing VS to the desktop if you trip this website's name.
This is one such side-effect, the runtime code limits the MinimumSize to the Screen.WorkingArea and does so at design time as well. Just try typing in (0, 3000) to see that happening. You can force it by assigning the property in code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With