How can I make a CListCtrl
to resize the width of its columns automatically? Usually, when an item in the list gets too long, the back end disappears from view and the user manually has to resize the width of the corresponding column.
Is there any way to do this by code?
Resizing the columns automatically is easy:
for(int i = 0;i < pListCtrl->GetHeaderCtrl()->GetItemCount();++i)
pListCtrl->SetColumnWidth(i,LVSCW_AUTOSIZE_USEHEADER);
This will optimize the columns.