CListCtrl控件的问题

lm9764 2002-10-18 08:27:51
for(int nListEntry=0;!m_setComplete.IsEOF();nListEntry++)
{
m_lcRepeaterList.InsertItem(nListEntry,LPCTSTR(itoa(m_setComplete.m_iId,szBuffer,10)),0);

m_lcRepeaterList.SetItemText(nListEntry,1,LPCTSTR(m_setComplete.m_strFrequency));

m_lcRepeaterList.SetItemText(nListEntry,2,LPCTSTR(m_setComplete.m_strCallsign));

m_lcRepeaterList.SetItemText(nListEntry,3,LPCTSTR(m_setComplete.m_strInput));

m_lcRepeaterList.SetItemText(nListEntry,4,LPCTSTR(m_setComplete.m_strCity));

m_lcRepeaterList.SetItemText(nListEntry,5,LPCTSTR(m_setComplete.m_strState));

m_setComplete.MoveNext();
}

为何我的CListCtrl 控件中只显示InsertItem那一行???SetItemText 都不显示??

BOOL SetItemText( int nItem, int nSubItem, LPTSTR lpszText );nItem

Index of the item whose text is to be set.//item 指的是哪个东西??

nSubItem

Index of the subitem, or zero to set the item label.//subitem指的是???

lpszText

Pointer to a string that contains the new item text.


请高手指点!!!!!!!!
...全文
83 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
lm9764 2002-10-18
  • 打赏
  • 举报
回复
加上了可以!十分感谢!!!!!
zhaolaoxin 2002-10-18
  • 打赏
  • 举报
回复
你再试试将SetItem()中的nListEntry换成InsertItem()的返回值。
zhaolaoxin 2002-10-18
  • 打赏
  • 举报
回复
看你的用法没错啊。你可以先看看是否将列头加上了。
wuxuan 2002-10-18
  • 打赏
  • 举报
回复
insert into listctrl sample.

int nNewItem=0;
char tmpstr[4];
LV_ITEM lvi;
lvi.mask = LVIF_TEXT|LVIF_IMAGE|LVIF_PARAM;
lvi.iItem = iNo+1;
lvi.iSubItem = 0;

lvi.iImage = passitem.Passtype;
lvi.pszText = "";
nNewItem = m_PassList.InsertItem(&lvi);

sprintf(tmpstr,"%d",m_PassList.GetItemCount());
m_PassList.SetItem(nNewItem, 1, LVIF_TEXT, tmpstr , 0, 0, 0, 0);
m_PassList.SetItem(nNewItem, 2, LVIF_TEXT, passitem.Itemname, 0, 0, 0, 0);
m_PassList.SetItem(nNewItem, 3, LVIF_TEXT, passitem.Accounts, 0, 0, 0, 0);
m_PassList.SetItem(nNewItem, 4, LVIF_TEXT, passitem.Password, 0, 0, 0, 0);
m_PassList.SetItem(nNewItem, 5, LVIF_TEXT, PassTypeStr[passitem.Passtype], 0, 0, 0, 0);

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧