Hello!
List.Create(WS_CHILD | WS_VISIBLE | LVS_REPORT | LVS_EX_SUBITEMIMAGES | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | WS_TABSTOP, CRect(0, 0, 0, 0), this, IDC_LIST);
m_pImg = new CImageList;
m_pImg->Create (16, 16, ILC_MASK, 8, 8);
List.SetImageList(m_pImg, LVSIL_SMALL);
Above you can see how I create ImageList for
CListCtrl
in
OnInitDialog()
, and also set this list to my control.
Here you can see how I add columns:
List.InsertColumn(0, _T("A"), LVCFMT_LEFT, NUM_COL);
List.InsertColumn(1, _T("B"), LVCFMT_LEFT, NAME_COL);
List.InsertColumn(2, _T("C"), LVCFMT_LEFT, TAG_COL);
I get some image and add it to my list
HICON icon = some image
m_pImg->Add(icon)
Under above code following this:
List.InsertItem(i, forNum); List.SetItemText(i, 1, Name); List.SetItemText(i, 2, C);
I need picture in rows of second column B, but I get picture in rows of first column A. I don't know why
I have a few type of images. How can I add different images to different rows
Thank you!
PS I hope my question will help everybody who is beginner in MFC!