我用一下代码生成一个list,但是顺序不对,大家看看,
int n=m_pAddID->m_nvecID.size();
CRobotInfo temp;
int i=0;
int m=m_vecRobotInfo.size();
while (i<n)
{
CString temp1;
temp1.Format("%d",m+1);
m_pListCtrl->InsertItem(m,temp1);
i++;
m++;
}如果我现在m=0;n=3我的结果是
3
2
1
而不是
1
2
3
int n=m_pAddID->m_nvecID.size();
CRobotInfo temp;
int i=0;
int m=m_vecRobotInfo.size();
while (i<n)
{
CString temp1;
temp1.Format("%d",m+1);
m_pListCtrl->InsertItem(m,temp1);
i++;
m++;
}如果我现在m=0;n=3我的结果是
3
2
1
而不是
1
2
3
改成temp1.Format("%d",i);就知道listCtrl自己排序没有了
如果没有 自然是你m的问题了
在初始化list的时候设置其样式.具体查看MSDN