Add an expander (collapse/expand) to a Panel WinForm

前端 未结 5 884
予麋鹿
予麋鹿 2020-12-05 09:50

I have a panel containing a DataGridView and 3 buttons at the bottom of a form. I want to add the possibility to expand and collapse this panel. Is there a way to do it in a

5条回答
  •  臣服心动
    2020-12-05 10:33

    An alternative to using the SplitContainer collapse is to:

    Dock the panel, to where you would like it, and then change it's Visible property to show/hide it. This way other docked items will move to fill the space when it's invisible (depending on their Dock setting).

    For example, if the button, panel, and a label are all docked to the top (in that order) when you hide the panel the label will shift up to underneath the button.

提交回复
热议问题