2011-02-09 75 views
3


我注意到,添加到TableLayoutPanel的每個控件都被賦予「列」和「行」屬性。 如何通過代碼訪問這些屬性?
謝謝:)TableLayoutPanel的控件列屬性

+0

這是Windows窗體嗎?如果將其包含在標籤中,您會得到更好的答案。 – driis 2011-02-09 17:43:44

+0

是:)(多幾個字符,越是這樣,我可以張貼此評論。) – Idov 2011-02-09 17:45:51

回答

5

這些屬性只在屬性窗口中存在由IExtenderProvider接口提供,魔術。它們在運行時不存在。擴展屬性是:

  • ColumnSpan。運行時間:GetColumnSpan()和SetColumnSpan()
  • 行跨度。運行時間:GetRowSpan()和SetRowSpan()
  • 行。運行時間:GETROW()和SetRow()
  • 細胞。運行時間:GetCellPosition()和SetCellPosition()
  • 列。運行時:GetColumn()和SetColumn()

TLP顯然是高度優化的,可供設計人員使用。這在運行時有點痛苦。

3

here

此性質通過手段添加的「延伸的屬性」的東西的像ToolTip用途其他控件。

0

//創建TableLayoutPanel TableLayoutPanel tlp = new TableLayoutPanel();

//設置BorderStyle爲插入 tlp.CellBorderStyle = TableLayoutPanelCellBorderStyle.Inset;

// Grid has two columns 
tlp.ColumnCount = 2; 

// Grid has two rows 
tlp.RowCount = 2; 

// If grid is full add extra cells by adding column 
tlp.GrowStyle = TableLayoutPanelGrowStyle.AddColumns; 

// Padding (pixels)within each cell (left, top, right, bottom) 
tlp.Padding = new Padding(1, 1, 4, 5); 

// Add TableLayoutPanel to the Forms controls 
this.Controls.Add(tlp); 

for more check this

http://en.csharp-online.net/TableLayoutPanel

3

雖然屬性設計者示出了行和列作爲增加的控制大公的屬性被設置編程方式使用表佈局面板本身上的方法(SetColumn(對照,索引)和SetRow(控制,索引))。

行爲的這種模式是類似的工具尖端分量和誤差分量。