Set minimum window size in C# .NET

后端 未结 4 1611
鱼传尺愫
鱼传尺愫 2020-12-05 10:07

I am having trouble setting the minimum size of my window in a C# application I am working on. I have tried this code in the form\'s constructor:

this.Minim         


        
4条回答
  •  旧时难觅i
    2020-12-05 10:33

    You need to assign directly to the MinimumSize property:

    this.MinimumSize = new Size(800, 600);
    

    Basically, the return value of the MinimumSize property is always a new struct object; the compiler doesn't let you assign to this temporary value (as stated in the error, it's not a variable).

    This MSDN Social thread is most enlightening about the subject.

提交回复
热议问题