this.tableLayoutPanel1.RowCount++;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, this.tableLayoutPanel1.Height/this.tableLayoutPanel1.RowCount));
Button btn = new Button();
btn.Visible = true;
this.tableLayoutPanel1.Controls.Add(btn, 0, this.tableLayoutPanel1.RowCount - 1);我是想实现在tableLayoutPanel1下面多加一行,而不是在里面,多加一行的格式和tableLayoutPanel1其它行的格式一样?
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, this.tableLayoutPanel1.Height/this.tableLayoutPanel1.RowCount));
Button btn = new Button();
btn.Visible = true;
this.tableLayoutPanel1.Controls.Add(btn, 0, this.tableLayoutPanel1.RowCount - 1);我是想实现在tableLayoutPanel1下面多加一行,而不是在里面,多加一行的格式和tableLayoutPanel1其它行的格式一样?
int height = this.tableLayoutPanel1.Height / this.tableLayoutPanel1.RowCount;
this.tableLayoutPanel1.Height += height;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, height));
this.tableLayoutPanel1.RowCount++;
tableLayoutPanel1.Parent.Controls.Add(...);
tableLayoutPanel1.Parent.ResumeLayout();