是我错吗?还是小比尔的错?
下面的程序其实很简单,就是删除CListBox中选中的多项,但实际上操作中我老发现,每次删除的项好象个数都少于所选择的项,但是老找不出错在哪里?(该控制已经设置为多选了)
CListBoxDlg::DeleteAtlases()
{
int nCount = m_AtlasList.GetSelCount();
CArray<int,int> aryListBoxSel;
int nIndex;
aryListBoxSel.SetSize(nCount);
m_AtlasList.GetSelItems(nCount, aryListBoxSel.GetData());
for( int i=0;i<nCount;i++ )
{
nIndex = aryListBoxSel[i];
m_AtlasList.DeleteString( nIndex );
}
//要设置当前选择项
#ifdef _DEBUG
afxDump << aryListBoxSel;
#endif
}