Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TableLayoutPanel's Control Columns properties


I've noticed that every control added to the TableLayoutPanel is given "Column" and "Row" properties. How can I get access to these properties through code?
thanks:)

like image 937
Idov Avatar asked Dec 16 '22 17:12

Idov


2 Answers

These properties only exist in the Properties Window, magic provided by the IExtenderProvider interface. They don't exist at runtime. Extended properties are:

  • ColumnSpan. Runtime: GetColumnSpan() and SetColumnSpan()
  • RowSpan. Runtime: GetRowSpan() and SetRowSpan()
  • Row. Runtime: GetRow() and SetRow()
  • Cell. Runtime: GetCellPosition() and SetCellPosition()
  • Column. Runtime: GetColumn() and SetColumn()

Obviously TLP was highly optimized to be used from the designer. It's kinda of a pain at runtime.

like image 189
Hans Passant Avatar answered Dec 30 '22 02:12

Hans Passant


Although the properties designer shows the row and column as properties of the added control thay are set programatically using a method on the table layout panel itself (SetColumn(control, index) and SetRow(control, index)).

This pattern of behaviour is similar the tool tip component and the error component.

like image 29
Spencer Booth Avatar answered Dec 30 '22 00:12

Spencer Booth