ListCtrl获取首列值相同的插入算法

来源:互联网 发布:电子证书制作软件 编辑:程序博客网 时间:2024/06/07 10:18
ListCtrl的InsertItem方法默认首列不相同,若首列值相同,则每次均插入第0行。
修改算法如下:
int nSize = 100;

int nCount = 0;
 for (int i = 0; i < nSize; i++)
 {
   CString sValue;
  sValue.Format("%d", nCount);

  int nInsLine = InsertItem(nCount, sValue);
  nCount++;

  int nColumn = 0;
  for (int j = 0; j < vRecord.size(); j++)
  {
     sValue = recordItem.sValue;
     SetItemText(nInsLine, nColumn, sValue);
   nColumn++; 
  }
 }

原创粉丝点击