dotnetmonitor.com

 
Index
Previous
Next

 

The Row and Column Styles collection are used to determine how to allocate space within the table. Rows and columns are allocated space in a non-autosized TableLayoutPanel in the following order:

  1. Absolutely columns/rows (full space allocated)
  2. AutoSized columns/rows (as much as possible to fit the controls in the column/row)
  3. Percentage columns/rows (distribution of remaining space)

 

Example I: Percentage styled columns attempt to fill the remaining space. So a 200px wide table with 20px absolute, an auto sized column and a 100% column would go like this:

 

  1. col1 ABS: 20 px
  2. col2 AUTO: whatever the preferred size is... say this measures to be 100px
  3. col3 100%: 200 - 20 - 100 = 80px.

 

Example II: If there are two percentage style columns, the 80 pixels would be divied up between the two columns in proportion to one another - so if we had 20% and 80% it would be:

 

  1. col1 ABS: 20 px
  2. col2 AUTO: whatever the preferred size is... say this measures to be 100px
  3. col3 20%: (200 - 20 100) = 80px remaining space. 80px * .20 = 16px.
  4. col4 80%: (200 - 20 100) = 80px remaining space. 80px * .80 = 64px.

 

Example III: Exactly the same as above but the two percentage style columns are both 75%, the 80 pixels would be split equally between the two normalized columns:

 

  1. col1 ABS: 20 px
  2. col2 AUTO: whatever the preferred size is... say this measures to be 100px
  3. col3 75% (normalizes to 50%): (200 - 20 100) = 80px remaining space. 80px * .50 = 40px.
  4. col4 75% (normalizes to 50%): (200 - 20 100) = 80px remaining space. 80px * .50 = 40px.

 

Example IV: The last column covers the table layout panels underwear. So a 200px wide table with 20px absolute, an auto sized column and a 20px absolute would go like this:

 

  1. col1 ABS: 20 px
  2. col2 AUTO: whatever the preferred size is... say this measures to be 100px
  3. col3 ABS: 20 px, not enough pixels so we stretch the last column to be (200 - 20 100) = 80px
Terms
Docking Anchor Layout
What happens when I have Dock and Anchors that conflict?
Dock Scenarios
Padding Margin
You have a perf problem with Layout - how to diagnose?