Monday, May 7, 2007

Datagridview resize column

A new thing with the DataGridView of the Framework 2.0 is the way to automaticly size the width of the column. Most of the common way to size the grid are already done for you.

All the magic with the DataGridView column resize is in the DataGridView property called AutoSizeMode. By default, the value is NotSet, thence you do not see any thing resized. If you want to manually set the width, use None. One of the coolest resize is ColumnHeader that let you resize the column depending of the length of the text in the column header. Have fun with all others values possibles.

No comments: