我在CAcUiDockControlBar类派生的窗口中,创建了一个树形控件,可是却不显示各项的图标。 是不是CAcUiDockControlBar类有特殊的处理方法,请有经验的朋友指点一下。 谢谢。 下面是相关程序段: enum MyIcon{rIcon, hIcon}; CImageList* pImage = new CImageList; pImage->Create(IDB_BITMAP_TREE, 16, 0, ::GetSysColor(COLOR_WINDOW));
if(!m_wndTree.Create(WS_CHILD|WS_VISIBLE|TVS_HASBUTTONS|TVS_LINESATROOT|TVS_HASLINES, CRect(0,0,200,180), &m_wndTab, //把m_wndTree创建在m_wndTab上 _IDC_TREE_DESIGN) ) return -1;
m_wndTree.ModifyStyleEx(0, WS_EX_CLIENTEDGE); m_wndTree.SetImageList(pImage, TVSIL_NORMAL);
HTREEITEM hRoot, hCur; TVINSERTSTRUCT TCItem; ::ZeroMemory(&TCItem, sizeof(TVINSERTSTRUCT));
TCItem.hParent=TVI_ROOT; TCItem.hInsertAfter=TVI_LAST; TCItem.item.mask=TVIF_IMAGE|TVIF_TEXT; TCItem.item.pszText="根"; TCItem.item.iImage = iIcon1; TCItem.item.lParam=0; hRoot=m_wndTree.InsertItem(&TCItem);
for(int i=1; i<4; i++){ TCItem.hParent=hRoot; TCItem.item.pszText = csTreeArrayPL.GetBuffer(csTreeArrayPL.GetLength()); TCItem.item.iImage = hIcon; hCur = m_wndTree.InsertItem(&TCItem); } m_wndTree.Expand(hRoot,TVE_EXPAND); |