TableLayoutPanel用法

//

// tableLayoutPanel1

//

this.tableLayoutPanel1.ColumnCount = 1;

this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));

this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0);

this.tableLayoutPanel1.Controls.Add(this.button1, 0, 1);

this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;

this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);

this.tableLayoutPanel1.Name = "tableLayoutPanel1";

this.tableLayoutPanel1.RowCount = 2;

this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());

this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());

this.tableLayoutPanel1.Size = new System.Drawing.Size(284, 84);

this.tableLayoutPanel1.TabIndex = 4;

 

在TableLayoutPanel中的第一行添加一个Label,在第二行添加一个Button。
 label1可以被显示为多行,而且Winforms自动根据label1的实际宽度,调整了button1的位置

posted on 2010-06-19 12:19  rxie  阅读(21861)  评论(0编辑  收藏  举报