Click here to Skip to main content
15,881,803 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
actual problem in tablelayoutpanel is as below
In TableLayoutPanel if Dock = Fill and AutoSize = true then last column occupy all remaining space
so, last column is wide than other columns of tablelayoutpanel. I want all columns with same size
I have refer a solution but can't understand
link is http://stackoverflow.com/questions/2054667/in-tablelayoutpanel-if-dock-fill-and-autosize-true-then-last-column-row-occu[^]
now, i add an extra column and want to invisible it
but no direct property is available,
I have tried to make width of column zero but, still it shows the column
please help if you have some idea about this.
Posted

It's an old thread, but may help someone else.
This can be easily achieved:

C#
tableLayout1.ColumnStyles[4].SizeType = SizeType.Absolute;
tableLayout1.ColumnStyles[4].Width = 0;


Cheers.
 
Share this answer
 
Comments
Dave Kreskowiak 6-Aug-14 8:38am    
You forgot to mention a side-effect of your solution. If there are other rows/columns with percentage heights/widths, you're changing the layout of the entire TLP and all controls will move/grow/shrink (depending on docking) to take up the space. This may not have a desired effect.
ModemsysDev 6-Aug-14 8:49am    
You're right, I've tested without anchor nor docking, and all the columns with percentage widths. The other colums recalculate automatically to fill the space, and the controls inside get centered correctly.
this is OK for me.
Dave Kreskowiak 6-Aug-14 12:39pm    
All I said is that may not be a desired effect for other users.
There are no actual rows and columns in a tablelayoutpanel. TLP is an extension to existing controls to control where the control paints itself. You cannot hide a row or column in the TLP.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900