TableLayoutPanel

代码

 private void button3_Click(object sender, EventArgs e)
        {
            TableLayoutPanel tl = new TableLayoutPanel();
            tl.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single;
           
            for (int i = 0; i < 3; i++)
            {
                tl.RowStyles.Add(new RowStyle(SizeType.Percent, 30));
            }

            for (int i = 0; i < 3; i++)
            {
                tl.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 30));
            }

            //tl.ColumnCount = 3; 如果没有这两句赋值,则只显示一个大方框如下
            //tl.RowCount = 3;

            this.Controls.Add(tl);
        }

 

ss

posted @ 2016-07-28 11:05  新进社员  阅读(276)  评论(0)    收藏  举报