类中定义:
CTreeCtrl m_treeCtrl;
CImageList cImageList;
代码实现:
HICON hIcon;
CimageList.Create(16, 16, ILC_COLOR32| ILC_MASK, 4, 4);//16,16表示cImageList中图标大小,
//4,4表示cImageList最多储存4个图标
hIcon= ::AfxGetApp()->LoadIconW(IDI_ICON);
cImageList.Add(hIcon);
m_treeCtrl.SetImageList(&cImageList);
m_treeCtrl.InsertItem(_T("带图标节点"), 0, 0, NULL);