TableLayoutPanel
-
Hello, I have a problem on the table layout panel control. I wanted to create a program that on run time I could set the table layout panel's number of rows and columns. My Problem is that the spaces of each boxes on the table are not evenly distributed. How do I make it evenly distributed?
-
Hello, I have a problem on the table layout panel control. I wanted to create a program that on run time I could set the table layout panel's number of rows and columns. My Problem is that the spaces of each boxes on the table are not evenly distributed. How do I make it evenly distributed?
This code worked fine for columns, it can also be slightly modifed to fit for rows:
tableLayoutPanel1.ColumnStyles.Clear();
int numOfColumns = 4;
tableLayoutPanel1.ColumnCount = numOfColumns;
for (int i = 0; i < numOfColumns ; i++ )
{
ColumnStyle cStyle = new ColumnStyle();
cStyle.SizeType = SizeType.Percent;
cStyle.Width = 100 / numOfColumns;
tableLayoutPanel1.ColumnStyles.Add(cStyle);
}