Change form size at runtime in C#

前端 未结 6 1775
傲寒
傲寒 2021-01-01 19:32

How can I change window form size at runtime?

I saw examples, but every one requires Form.Size property. This property can be set like here: http://msdn.microsoft.co

6条回答
  •  半阙折子戏
    2021-01-01 20:11

    In order to call this you will have to store a reference to your form and pass the reference to the run method. Then you can call this in an actionhandler.

    public partial class Form1 : Form
    {
        public void ChangeSize(int width, int height)
        {
            this.Size = new Size(width, height);
        }
    }
    

提交回复
热议问题