CListCtrl SetItem问题 [英] CListCtrl SetItem Problem

查看:87
本文介绍了CListCtrl SetItem问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我需要更新列表控件图片.我正在将报表视图与LVS_EX_GRIDLINES一起使用.

我有一个包含10张图像的图像列表.在更新我的listctrl图像时,没有改变..

Hi guys, i need to update my list controls image. I am using Report view with LVS_EX_GRIDLINES.

I have a image list which contains 10 images. when am updating my listctrl image is not chaged..

void CProView::UpdateLogEntry(CString strEntryID)
{
	CListCtrl& list = GetListCtrl();
	LVFINDINFO lvfInfo;
	lvfInfo.flags = LVFI_STRING | LVFI_WRAP;
	lvfInfo.psz = strEntryID;
	int nPos = 0;

	if((nPos = list.FindItem(&lvfInfo)) != -1)
	{
		list.SetItem(nPos, 0, LVIF_TEXT, _T("Send"), 3, 0, 0, 0, 0);// Image 3 is not update im my clistctrl
		list.SetItemText(nPos, 4, _T("Yes"));
	}
}

推荐答案

我认为您只是忘记了LVIF_IMAGE掩码:
I think you just forgot the LVIF_IMAGE mask:
list.SetItem(nPos, 0, LVIF_TEXT | LVIF_IMAGE, _T("Send"), 3, 0, 0, 0, 0);


这篇关于CListCtrl SetItem问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆