CMainFrame* pMainFrm =(CMainFrame*)AfxGetApp()->m_pMainWnd;
CStateListView *lv1=(CStateListView*)(pMainFrm->m_wndSplitter1.GetPane(1,0));
CListCtrl& lc1=lv1->GetListCtrl();
lc1.DeleteAllItems();
for(int i=0;i<CStateListView::ColNum;i++)
lc1.DeleteColumn(0);
CStateListView::ColNum=0;
lc1.SetExtendedStyle(LVS_EX_GRIDLINES); lc1.InsertItem(0,_itoa(18,buffer,10));
lc1.InsertItem(0,_itoa(30,buffer,10));
lc1.InsertItem(0,_itoa(7,buffer,10));
、
出来第一列应该是18,30,7啊
但显示出来却是7,30 ,8
我在用循环插入数据,但第一列的序号总是不对,而且我要插入几百行数据,但一般插入2行下面的行就没有显示了,是不是没有给控件设置什么风格啊,还是怎么回事情啊帮帮我啊!
CStateListView *lv1=(CStateListView*)(pMainFrm->m_wndSplitter1.GetPane(1,0));
CListCtrl& lc1=lv1->GetListCtrl();
lc1.DeleteAllItems();
for(int i=0;i<CStateListView::ColNum;i++)
lc1.DeleteColumn(0);
CStateListView::ColNum=0;
lc1.SetExtendedStyle(LVS_EX_GRIDLINES); lc1.InsertItem(0,_itoa(18,buffer,10));
lc1.InsertItem(0,_itoa(30,buffer,10));
lc1.InsertItem(0,_itoa(7,buffer,10));
、
出来第一列应该是18,30,7啊
但显示出来却是7,30 ,8
我在用循环插入数据,但第一列的序号总是不对,而且我要插入几百行数据,但一般插入2行下面的行就没有显示了,是不是没有给控件设置什么风格啊,还是怎么回事情啊帮帮我啊!
Index of the item to be inserted.同意楼上的。
lc1.InsertItem(0,_itoa(18,buffer,10));
lc1.InsertItem(1,_itoa(30,buffer,10));
lc1.InsertItem(2,_itoa(7,buffer,10));
lc1.InsertItem(i,_itoa(30,buffer,10));
这样才能保证30插在18后面。至于“插入几百行数据,但一般插入2行下面的行就没有显示了”,这个lz还是要贴出代码来看看啊~~