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:
- Absolutely columns/rows (full space allocated)
- AutoSized columns/rows (as much as possible to fit the
controls in the column/row)
- 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:
- col1 ABS: 20 px
- col2 AUTO: whatever the preferred size is... say this
measures to be 100px
- 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:
- col1 ABS: 20 px
- col2 AUTO: whatever the preferred size is... say this
measures to be 100px
- col3 20%: (200 - 20 100) = 80px remaining space. 80px
* .20 = 16px.
- 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:
- col1 ABS: 20 px
- col2 AUTO: whatever the preferred size is... say this
measures to be 100px
- col3 75% (normalizes to 50%): (200 - 20 100) = 80px
remaining space. 80px * .50 = 40px.
- 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:
- col1 ABS: 20 px
- col2 AUTO: whatever the preferred size is... say this
measures to be 100px
- col3 ABS: 20 px, not enough pixels so we stretch the last
column to be (200 - 20 100) = 80px
|