Is it possible to set the Maximum Width for a Form but leave the Maximum Height Unrestricted?

前端 未结 3 595
别跟我提以往
别跟我提以往 2021-01-11 18:28

For some reason if you set both of the width and the height of Form.MaximumSize to zero it will let you have an unrestricted window size, however if you want to set a limit

3条回答
  •  梦毁少年i
    2021-01-11 19:00

    Use INT_MAX since that's the theoretical limit that can be represented by a Size anyway:

    //Max width 200, unlimited height
    this.MaximumSize = new Size(200, int.MaxValue);
    

提交回复
热议问题