VC如何在list中添加列,谢谢
发布网友
发布时间:2024-11-01 18:32
我来回答
共2个回答
热心网友
时间:2024-11-01 18:37
int CUserDlg::SetListItem(CUser &UserInfo, int Idex)
{
CString buffer;
LVITEM lvitem;
lvitem.mask = LVIF_IMAGE | LVIF_TEXT;
lvitem.iItem = Idex;
lvitem.pszText = "";
lvitem.iImage = UserInfo.pic_serial;
lvitem.iSubItem = 0;
m_list_user.InsertItem(&lvitem);
lvitem.mask = LVIF_TEXT;
lvitem.iItem = Idex;
buffer.Format("%d", UserInfo.num);
lvitem.pszText = buffer.GetBuffer(0);
buffer.ReleaseBuffer();
lvitem.iSubItem = 0;
m_list_user.SetItem(&lvitem);
buffer.Format("%s", UserInfo.name);
lvitem.pszText = buffer.GetBuffer(0);
buffer.ReleaseBuffer();
lvitem.iSubItem = 1;
m_list_user.SetItem(&lvitem);
m_list_user.SetItem(&lvitem);
buffer.Format("%s", UserInfo.nickname);
lvitem.pszText = buffer.GetBuffer(0);
buffer.ReleaseBuffer();
lvitem.iSubItem = 2;
m_list_user.SetItem(&lvitem);
buffer.Format("%d", UserInfo.age);
lvitem.pszText = buffer.GetBuffer(0);
buffer.ReleaseBuffer();
lvitem.iSubItem = 3;
m_list_user.SetItem(&lvitem);
buffer.Format("%s", UserInfo.sex);
lvitem.pszText = buffer.GetBuffer(0);
buffer.ReleaseBuffer();
lvitem.iSubItem = 4;
m_list_user.SetItem(&lvitem);
return 0;
}
热心网友
时间:2024-11-01 18:37
InsertColumn