|
I am trying to add/remove controls from TableLayoutPanel dynamically. Basic layout has 3 controls , one row and 2 columns, with GrowStyle set to AddRows. When additional controls are added, new row is added to the panel without any issues. I have code to add a new Row Style ( with SizeType as percent) and update the Row Count. THere are no issues with adding multiple controls and the panel size increases as expected by adding more rows. Issue that I am seeing is when the last control of row is removed, I was hoping to remove the row and shrink the size of the layout panel. But, layout panel size is being maintained without shrinking for the removed row. I tried by setting AutoSizeMode propert to GrowAndShrink, hoping that when a row is removed, panel size would shrink proportionately. This attempt failed. Are there any other options? which would allow the panel size to shrink when a row is removed. ( Similar to panel size increase when row is added). Please provide your feedback. Thanks. |