2013-10-26 1 views
2

프로그래밍 방식으로 tablelayoutpanel을 만들고 싶습니다. 다음과 같은 코드가 있습니다 :TableLayoutPanel이 표시되지 않습니다. C#

 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); 

그러나 Windows 형식에서는 볼 수 없습니다. 이 코드는 오류없이 실행됩니다. 어떤 아이디어? 국경 볼 수 있도록

+0

당신이 당신이 패널에 대한 내용을 추가하지 않으면 볼 것으로 예상합니까? – pescolino

답변

3

, 당신은 사용할 수 있습니다

tlpCurrent.CellBorderStyle= TableLayoutPanelCellBorderStyle.Single; 
관련 문제