Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide and show a cell of the TableLayoutPanel

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?

like image 419
Bohn Avatar asked Jul 20 '10 13:07

Bohn


People also ask

How to hide a row in TableLayoutPanel c#?

If all your rows styles have the SizeType property set to Absolute , but the row style you want to hide is set to AutoSize , all you need to do is set the property Visible to False in every control inside the row style. In my example, my TableLayoutPanel has three columns.

What is TableLayoutPanel C#?

TableLayoutPanel control represents a panel that dynamically lays out its contents in a table format. You want to use a TableLayoutPanel in complex and sophisticated applications where you need to create dynamic layouts.


2 Answers

If rows in your TableLayoutPanel is autosized then hiding content panel will hide cell where panel placed too.

like image 74
arbiter Avatar answered Sep 21 '22 13:09

arbiter


I would suggest setting the other rows heights to 0 is the easiest way:

Row one:

this.tableLayoutPanel1.RowStyles[1].Height = 0;
like image 23
Martin Tapp Avatar answered Sep 20 '22 13:09

Martin Tapp