TableLayoutPanel不显示为C#

TableLayoutPanel不显示为C#,c#,winforms,tablelayoutpanel,C#,Winforms,Tablelayoutpanel,我想以编程方式创建tablelayoutpanel。我的代码如下: TableLayoutPanel tlpCurrent = new TableLayoutPanel(); tlpCurrent.RowStyles.Clear(); tlpCurrent.RowCount++; tlpCurrent.RowStyles.Add(new RowStyle(SizeType.Absolute, 40f)); tlpCu

我想以编程方式创建tablelayoutpanel。我的代码如下:

        TableLayoutPanel tlpCurrent = new TableLayoutPanel();
        tlpCurrent.RowStyles.Clear();
        tlpCurrent.RowCount++;
        tlpCurrent.RowStyles.Add(new RowStyle(SizeType.Absolute, 40f));
        tlpCurrent.RowCount++;
        tlpCurrent.RowStyles.Add(new RowStyle(SizeType.Absolute, 40f));
        tlpCurrent.RowCount++;
        tlpCurrent.RowStyles.Add(new RowStyle(SizeType.Absolute, 40f));
        tlpCurrent.RowCount++;
        tlpCurrent.RowStyles.Add(new RowStyle(SizeType.Absolute, 40f));
        tlpCurrent.RowCount++;
        tlpCurrent.RowStyles.Add(new RowStyle(SizeType.Absolute, 40f));
        tlpCurrent.RowCount++;
        tlpCurrent.RowStyles.Add(new RowStyle(SizeType.Absolute, 40f));
        tlpCurrent.RowCount++;
        tlpCurrent.RowStyles.Add(new RowStyle(SizeType.Absolute, 40f));
        tlpCurrent.RowCount++;
        tlpCurrent.RowStyles.Add(new RowStyle(SizeType.Absolute, 40f));

        tlpCurrent.ColumnStyles.Clear();
        tlpCurrent.ColumnCount++;
        tlpCurrent.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 150f));

        for (int i = 0; i < 3; i++)
        {
            tlpCurrent.ColumnCount++;
            tlpCurrent.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 150f));
        }

        tlpCurrent.Location = new Point(500, 100);
        tlpCurrent.Size = new System.Drawing.Size(300, 300);
        tlpCurrent.AutoSize = true;
        this.Controls.Add(tlpCurrent);
TableLayoutPanel tlpcCurrent=新建TableLayoutPanel();
tlpCurrent.RowStyles.Clear();
tlpCurrent.RowCount++;
添加(新的行样式(SizeType.Absolute,40f));
tlpCurrent.RowCount++;
添加(新的行样式(SizeType.Absolute,40f));
tlpCurrent.RowCount++;
添加(新的行样式(SizeType.Absolute,40f));
tlpCurrent.RowCount++;
添加(新的行样式(SizeType.Absolute,40f));
tlpCurrent.RowCount++;
添加(新的行样式(SizeType.Absolute,40f));
tlpCurrent.RowCount++;
添加(新的行样式(SizeType.Absolute,40f));
tlpCurrent.RowCount++;
添加(新的行样式(SizeType.Absolute,40f));
tlpCurrent.RowCount++;
添加(新的行样式(SizeType.Absolute,40f));
tlpcCurrent.ColumnStyles.Clear();
tlpCurrent.ColumnCount++;
tlpcCurrent.ColumnStyles.Add(新ColumnStyle(SizeType.Absolute,150f));
对于(int i=0;i<3;i++)
{
tlpCurrent.ColumnCount++;
tlpcCurrent.ColumnStyles.Add(新ColumnStyle(SizeType.Absolute,150f));
}
TLP电流位置=新点(500100);
tlpCurrent.Size=新系统图纸尺寸(300300);
tlpCurrent.AutoSize=true;
this.Controls.Add(tlpCurrent);

但我在windows窗体上看不到它。我确信这段代码运行时没有任何错误。有什么想法吗?

要使边框可见,您可以使用:

tlpCurrent.CellBorderStyle= TableLayoutPanelCellBorderStyle.Single;

如果不向面板添加任何内容,您希望看到什么?