Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I resize a Windows Forms form in C#?

I am making a Windows Forms application. I want the forms height to increase after a button is pressed. How do I do this?

like image 671
user1713155 Avatar asked Dec 15 '22 18:12

user1713155


2 Answers

Use the Height property. For instance:

this.Height = newHeight;
like image 62
CrazyCasta Avatar answered Dec 28 '22 10:12

CrazyCasta


You can just increase the form height value by a specified amount on the button click:

private void button1_Click(object sender, EventArgs e)
{
    int amountToIncrease = 10;
    this.Height += amountToIncrease;
}    
like image 45
CC Inc Avatar answered Dec 28 '22 08:12

CC Inc