문제

I am creating a simple Windows form application using Visual C#.

The form is can re-sized by the user (by click and drag). But, I don't want the user to decrease the dimensions of the form beyond a certain limit. How can I set the limits?

도움이 되었습니까?

해결책

Go to your form in VS and press F4 to get to the properties of the form and look for the MinimumSize property:

enter image description here

To set the size from code use:

this.MinimumSize = new Size(100, 100);

Note that this does not prevent minimising/maximising the form! If you want to prevent this, then set the MaximizeBox property to false.

다른 팁

In the WinForm properties there is minimum size property see here http://msdn.microsoft.com/en-us/library/system.windows.forms.form.minimumsize(v=vs.110).aspx

To change it on run-time:

int width, height;
this.MinimumSize = new Size(width, height);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top