Hi,
Is there a way to resize the listcontrol automatically? Usually when the item gets too long the back end disappears from view and the user manually has to resize the width of the column. Is there anyway to do this by the code?
Thank You!!
Hi,
Is there a way to resize the listcontrol automatically? Usually when the item gets too long the back end disappears from view and the user manually has to resize the width of the column. Is there anyway to do this by the code?
Thank You!!
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.
I assume you mean a list control in report mode? Unfortunately there is no way to automatically resize columns. What you can do (what I do in some places) is calculate the width of columns as you enter items, then handle WM_SIZE and resize the columns. However this causes changes that the user made to be lost, so you may need a better algorithm like tracking if the user made any changes, if he did don't resize. It's not very nice from a UX perspective, I only use it in a select amount of circumstances where the behavior makes sense in the context of the rest of the UI.
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.