Windows Forms hide sections

I have a windows form (C# code behind) that opens for the user to edit records. What I want to do is create sort of a 2nd part to the form, initially hidden. So the form actually is a certain size showing all controls, but when it opens it's not showing everything. I would like to have a button on the form that will hide or display the bottom half when clicked. Is there a way to do this?
Who is Participating?
SStoryConnect With a Mentor Commented:
Sure, just resize the form.. Start with the form sized not showing them, then when the button is clicked change formname.height=new height, clicked again, change it back.
Fernando SotoRetiredCommented:
You can place a panel in the area you want to hide and show and in that panel place all the control in the panel that you wish to hide and show. in the property window for the panel make the panel Visible property to false. then in the button click event to hide and show place this code.

 panel1.Visible = !panel1.Visible;

Open in new window

Then every click of that button will hide and show all the controls in the panel.
David Johnson, CD, MVPOwnerCommented:
set the visible property of the items you want hidden to false. When you want to display them set the visible property of the controls to true

 private void button1_Click(object sender, EventArgs e)
        webBrowser1.Visible = true;

        private void button2_Click(object sender, EventArgs e)
            webBrowser1.Visible = false;

Open in new window

dodgerfanAuthor Commented:
That got it, thanks.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.