CListCtrl &listCtrl = GetListCtrl();
int nColumnCount = listCtrl.GetHeaderCtrl()->GetItemCount();
for (int i=0;i < nColumnCount;i++)
{
// Wrong method to delete all of the columns.
listCtrl.DeleteColumn(i);//the second column can not be deleted
//Correct method to delete all columns
listCtrl.DeleteColumn(0);//when first column is deleted, the second one become the first column,the third one is the second now.So you should always delete the first column
}
int nColumnCount = listCtrl.GetHeaderCtrl()->GetItemCount();
for (int i=0;i < nColumnCount;i++)
{
// Wrong method to delete all of the columns.
listCtrl.DeleteColumn(i);//the second column can not be deleted
//Correct method to delete all columns
listCtrl.DeleteColumn(0);//when first column is deleted, the second one become the first column,the third one is the second now.So you should always delete the first column
}
CListCtrl &listCtrl = GetListCtrl();
int nColumnCount = listCtrl.GetHeaderCtrl()->GetItemCount();
for (int i=nColumnCount-1;i <0 ;i--)
{
listCtrl.DeleteColumn(i);
}
CListCtrl &listCtrl = GetListCtrl();
int nColumnCount = listCtrl.GetHeaderCtrl()->GetItemCount();
for (int i=nColumnCount-1;i <0 ;i--)
{
listCtrl.DeleteColumn(i);
}
谢谢各位,不过多次调用增加、删除后视中会产生水平滚动条。无法去掉它!!to tangby(sinababy)
重新生成后会覆盖原来的吗??