//if the current style is not report, the following three lines is not need
GetListCtrl().DeleteAllItems();
for(int h=GetListCtrl().GetHeaderCtrl()->GetItemCount();h>0;h--)
GetListCtrl().DeleteColumn(h-1);
LONG lStyle;
for(int h=GetListCtrl().GetHeaderCtrl()->GetItemCount();h>0;h--)
GetListCtrl().DeleteColumn(h-1);
LONG lStyle;
//Get current window style
lStyle=GetWindowLong(GetListCtrl().GetSafeHwnd(),GWL_STYLE);
lStyle=GetWindowLong(GetListCtrl().GetSafeHwnd(),GWL_STYLE);
//Clear original type mask
lStyle &= ~LVS_TYPEMASK;
//Add new type style,the sample is icon
//Add new type style,the sample is icon
lStyle|=LVS_ICON;
//Ok,set new type style
SetWindowLong(GetListCtrl().GetSafeHwnd(),GWL_STYLE,lStyle);
SetWindowLong(GetListCtrl().GetSafeHwnd(),GWL_STYLE,lStyle);
博客给出一段代码,若当前样式非报告样式,会删除列表控件所有项和列。还获取当前窗口样式,清除原有类型掩码,添加新的类型样式(如图标样式),最后设置新的类型样式。
7097

被折叠的 条评论
为什么被折叠?



