限制窗体大小

Posted on 2018-12-09 18:24  努力成长静待花开  阅读(201)  评论(0编辑  收藏  举报

实现代码:

  

知识运用:

  窗体的Width属性 Height属性 用于获取或设置窗体的宽度(高度)  属性值以像素为单位

  和FormBorderStyle属性   用于 获取或设置窗体的边框样式  属性值为FormBorderStyle枚举值

  

 实现代码:

        private void Form1_Load(object sender, EventArgs e)
        {
            this.Width = 400;
            this.Height = 300;
            this.FormBorderStyle = FormBorderStyle.FixedSingle;
        }