I have a TableLayoutPanel starting with two columns and 0 rows. What I need to do is, dynamically adding a row and filling both of the columns with different controls (it will be panels). In Form1 I am creating the TableLayout this way:
TableLayoutPanel Table = new TableLayoutPanel();
Table.Location = new Point(10, 40);
Table.Size = new Size(620,100);
Table.AutoSize = true;
Table.Name = "Desk";
Table.ColumnCount = 2;
Table.RowCount = 0;
Table.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
Table.GrowStyle = System.Windows.Forms.TableLayoutPanelGrowStyle.AddRows;
this.Controls.Add(Table);
afterwards during runtime I am getting how many rows will I need, and if they will be filled with either a Panel or some Label. It might happen that in the same row left will be Panel, right Label etc..
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…