Hy, could anyone please told me how can i move controls on a windows form when i click for example, on a button?
When i click on a button i want to increase the height of my form and move a textbox and label a little down...
Please help.Thanks

Recommended Answers

Do something like this:

private void button1_Click_1(object sender, EventArgs e)
        {
            // increment form height by 20
            this.Height += 20;
            //change heigth and location of button clicked
            Button btn = sender as Button;
            btn.Height += 10;
            btn.Location = new Point(50, 50);
        }
Jump to Post

All 2 Replies

Do something like this:

private void button1_Click_1(object sender, EventArgs e)
        {
            // increment form height by 20
            this.Height += 20;
            //change heigth and location of button clicked
            Button btn = sender as Button;
            btn.Height += 10;
            btn.Location = new Point(50, 50);
        }

Thank u so much!You were right.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.