views:

74

answers:

1

I want to create this TableLayoutPanel (C# in WinForms - programatically created at runtime!)

 ---------------------------------------------------------------------
|   01.01.2010 01:00   |   01.01.2010 01:00   |   01.01.2010 01:00    |
---------------------------------------------------------------------
|   Some text       |  More            | And         | Final text     |
|   (Multilined)    |  multilined      | more text   | Multiple lines,|
|                   |  text            |             | too            |
 ---------------------------------------------------------------------

But currently it lookes more like this

 ---------------------------------------------------------------------
| 01.01.2010 01:00 | 01.01.2010 01:00 | 01.01.2010 01:00              |
---------------------------------------------------------------------
| Some text    | More       | And       | Final text                  |
| (Multilined) | multilined | more text | Multiple lines,             |
|              | text       |           | too                         |
 ---------------------------------------------------------------------

How can I achieve the layout above - meaning, the columns' width is adjusted to fit the whole table equally - but if a column needs more space, it can resize itself to the preferred size?

A: 

Set the column Size Type to Percent instead of Absolute. Select the panel, click the little arrow glyph in the upper right corner, Edit Rows and Columns.

Hans Passant
I create the table at runtime, so I can't use the WinForm Designer. See -> http://stackoverflow.com/questions/3529098/multiple-tablelayoutpanels-for-complex-table
ApoY2k
Well, start another project, drop a TLP on the form and format it. Look at the generated code in the Designer.cs file and reproduce that in your own code.
Hans Passant