我在SDI程序的CTreeView对象中加入的树节点怎么没有图标,不知道在什么地方还要设置?
我检查了程序,图标引入,等都很正常啊!
void CDrivetreeView::OnInitialUpdate()
{
CTreeView::OnInitialUpdate();
// TODO: You may populate your TreeView with items by directly accessing
// its tree control through a call to GetTreeCtrl().
CImageList m_ImageList;
CTreeCtrl &tc = GetTreeCtrl();
m_ImageList.Create(16,16,0,8,8);
HICON hIcon[1];
hIcon[0]=AfxGetApp()->LoadIcon(IDI_CLOSE);
m_ImageList.Add(hIcon[0]);
tc.SetImageList(&m_ImageList,TVSIL_NORMAL);
HTREEITEM hItem;
hItem=tc.InsertItem(_T("OL"),TVI_ROOT,TVI_SORT);
if (hItem)
{
tc.InsertItem("J. S. Bach", 0, 0, hItem);
tc.InsertItem("W. A. Mozart", 0, 0, hItem);
tc.InsertItem("F. Chopin", 0, 0, hItem);
}
// expand
tc.Expand(hItem, TVE_EXPAND);
}