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.
Do you have the "No Scroll" option on? By default ("No Scroll" option off), if an item got too long a scroll bar would appear.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With