mfc list control 插入数据

西瓜爱吃橘子 2011-12-05 06:43:27
数据库里有 2到300多文字 插入到list中的一列。只显示了部分。

谢谢大虾们指教。
...全文
258 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Michael--Lee 2012-10-12
  • 打赏
  • 举报
回复
while (m_Recordset.m_pRecordset->adoEOF==0)
{
m_ctrlist.InsertItem(0,"");
m_ctrlist.SetItemText(0,0,(char*)(_bstr_t)m_recordsetPtr->GetCollect("StudentNo"));
m_ctrlist.SetItemText(0,1,(char*)(_bstr_t)m_recordsetPtr->GetCollect("StudentName"));
m_ctrlist.SetItemText(0,2,(char*)(_bstr_t)m_recordsetPtr->GetCollect("StudentSex"));
m_ctrlist.SetItemText(0,3,(char*)(_bstr_t)m_recordsetPtr->GetCollect("StudentPhone"));
m_ctrlist.SetItemText(0,4,(char*)(_bstr_t)m_recordsetPtr->GetCollect("StudentIn"));
m_ctrlist.SetItemText(0,5,(char*)(_bstr_t)m_recordsetPtr->GetCollect("StudentOut"));
m_ctrlist.SetItemText(0,6,(char*)(_bstr_t)m_recordsetPtr->GetCollect("StudentLearnfor"));
m_ctrlist.SetItemText(0,7,(char*)(_bstr_t)m_recordsetPtr->GetCollect("StudentOutReason"));
m_recordsetPtr->MoveNext();
}
向立天 2011-12-30
  • 打赏
  • 举报
回复
您好
我是本版版主
此帖已多日无人关注
请您及时结帖
如您认为问题没有解决可按无满意结帖处理
另外本版设置了疑难问题汇总帖
并已在版面置顶
相关规定其帖子中有说明
您可以根据规定提交您帖子的链接
如您目前不想结帖只需回帖说明
我们会删除此结帖通知

见此回复三日内无回应
我们将强制结帖
相关规定详见界面界面版关于版主结帖工作的具体办法
  • 打赏
  • 举报
回复
你可以用ToolTip的方式显示全的
Eleven 2011-12-05
  • 打赏
  • 举报
回复

typedef struct _LVITEM {
UINT mask;
int iItem;
int iSubItem;
UINT state;
UINT stateMask;
LPTSTR pszText;
int cchTextMax;
int iImage;
LPARAM lParam;
#if (_WIN32_IE >= 0x0300)
int iIndent;
#endif
#if (_WIN32_WINNT >= 0x560)
int iGroupId;
UINT cColumns; // tile view columns
PUINT puColumns;
#endif
#if (_WIN32_WINNT >= 0x0600)
int* piColFmt;
int iGroup;
#endif
} LVITEM, *LPLVITEM;


pszText
If the structure specifies item attributes, pszText is a pointer to a null-terminated string containing the item text. When responding to an LVN_GETDISPINFO notification, be sure that this pointer remains valid until after the next notification has been received.

If the structure receives item attributes, pszText is a pointer to a buffer that receives the item text. Note that although the list-view control allows any length string to be stored as item text, only the first 260 TCHARs are displayed.

15,979

社区成员

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

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