CTreeCtrl image set issue
-
I have a CTreeCtrl object in my dialog, this control is initialized as follows:
m_imgList.Create(16, 16, ILC_COLOR32, 1, 4);
CBitmap bitmap;
bitmap.LoadBitmap(IDB_BITMAP1);
m_imgList.Add(&bitmap, RGB(0, 0, 0));
bitmap.DeleteObject();bitmap.LoadBitmap(IDB_BITMAP2);
m_nFolderImgNdx = m_imgList.Add(&bitmap, RGB(0, 0, 0));
bitmap.DeleteObject();m_wndTree.SetImageList(&m_imgList, TVSIL_STATE);
hNewItem = m_wndTree.InsertItem(
TVIF_IMAGE | TVIF_PARAM | TVIF_STATE | TVIF_TEXT,
_T(""), 1, -1, nState,
TVIS_EXPANDED | TVIS_STATEIMAGEMASK,
(LPARAM)pData, hItem, TVI_LAST);Later in the code I update each item of the tree control - text and image.
m_wndTree.SetItemImage(hItem, 0, -1);
However the tree control item does not update its image icon. It always display's its 1st image even I set the 0th image during the update. Any idea what is the problem :confused: ? Thanks, Abyss