Change form size at runtime in C#

前端 未结 6 1758
傲寒
傲寒 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 19:56

    You cannot change the Width and Height properties of the Form as they are readonly. You can change the form's size like this:

    button1_Click(object sender, EventArgs e)
    {
        // This will change the Form's Width and Height, respectively.
        this.Size = new Size(420, 200);
    }
    

提交回复
热议问题