Hello everybody. In a small dialog-based program of mine I am using a CTreeCtrl with a variable amount of child items. Now I want some items to have an icon besides the text which reflects the item state (the icons should not depend on whether the tree is expanded or not!). From what I read I should be using state based images in that case. "Normal" icons work well, but there seems to be something wrong with state based icons - they are not showing up at all.
The code that I got up to now:
IDB_ICONS is a bitmap of 30x10 pixels in size (three 10x10 icons). What am I missing? Do I have to redraw the CTreeCtrl somehow to make the images show up?Code:BOOL CMyClassDlg::OnInitDialog() { //... m_ImageList.Create(IDB_ICONS, 10, 1, RGB(255,255,255)); m_tcDeviceList.SetImageList(&m_ImageList, TVSIL_STATE); //m_tcDeviceList.SetImageList(&m_ImageList, TVSIL_NORMAL); m_hTreeRoot = m_tcDeviceList.InsertItem(L"Root", TVI_ROOT); m_tcDeviceList.SetItemData(m_hTreeRoot, IDR_MENU_ROOT); m_tcDeviceList.SetItemImage(m_hTreeRoot, 1, 1); HTREEITEM item; item = m_tcDeviceList.InsertItem(L"Child", m_hTreeRoot); m_tcDeviceList.SetItemData(item, IDR_MENU_CHILD); m_tcDeviceList.SetItemImage(item, 0, 0); //... }
Thanks in advance.




Reply With Quote