Support
Joined: 18 Jul 2005 Posts: 731
|
Posted: Tue Apr 21, 2009 12:14 pm 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:
[C++]
Code: | m_fileVw.SetColumnWidth(_T(""),0,-1); // Autosize the column at index '0'
or
m_fileVw.SetColumnWidth(_T("Name"),0,-1); // Autosize the 'Name' column |
[VB6]
Code: | fileVw.SetColumnWidth "", 0, -1 ' Autosize the column at index '0'
or
fileVw.SetColumnWidth "Name", 0, -1 ' Autosize the 'Name' column |
Note
To make the last column expand to fit the FileView width, use the following code:
[C++]
Code: | // Expand width of last column to fit FileView width
m_fileVw.SetColumnWidth(_T(""),m_fileVw.GetColumnCount()-1,-2); |
[VB6]
Code: | 'Expand width of last column to fit FileView width
fileVw.SetColumnWidth "", fileVw.ColumnCount - 1, -2 |
|
|