Support
Joined: 18 Jul 2005 Posts: 731
|
Posted: Tue Apr 21, 2009 4:30 am Post subject: HOWTO: Automatically resize a column to fit the width of the longest text under that column |
|
|
The following code automatically resizes a column to fit the width of the longest text under that column:
Code: | fileView1.SetColumnWidth(string.Empty,0,-1); // Autosize the column at index '0'
or
fileView1.SetColumnWidth("Name",0,-1); // Autosize the 'Name' column |
Note
To make the last column expand to fit the FileView width, use the following code:
Code: | // Expand width of last column to fit FileView width
fileView1.SetColumnWidth(string.Empty,fileView1.ColumnCount-1,-2); |
|
|