My tablelayout panel has one column and three rows. (one docked to Fill panel in each cell.)
Now I would like to be able to hide/show the rows . I want only one row to be visible at any time ( based on a user selection of some radio buttons) and I want to to get resized so it fills all the area of the TableLayoutPanel.
How can I do that? Any thoughts?
If rows in your TableLayoutPanel is autosized then hiding content panel will hide cell where panel placed too.
Try this
So why did you use a
TableLayoutPanel
?Just put three
Panel
s on your form, fill in everyone the content of each row and set theDock
property of all three panels toFill
. Set two panelsVisible = false
and one totrue
.If you like to see another panel, just make it visible and hide the other two (based on your radio button settings).
I tried fooling around with the
Height
andSizeType
properties, but it was giving me odd results. For example, the Labels on the target row were being hidden, but the TextBoxes were not.Here is an extension class that I came up with using @arbiter's suggestion of hiding the children Controls of the row.
To hide row try this!!
I would suggest setting the other rows heights to 0 is the easiest way:
Row one: