Question

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

Was it helpful?

Solution

Use the Height property. For instance:

this.Height = newHeight;

OTHER TIPS

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;
        }    
this.Size = new Size(175, 125);

or

this.ClientSize = new Size(175, 125);

From MSDN: The size of the client area of the form is the size of the form excluding the borders and the title bar.

http://msdn.microsoft.com/en-us/library/9278sfx2(v=vs.80).aspx

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top