mImageList.Create(16,16,ILC_COLOR24|ILC_MASK,1,1);
mImageList.Add(LoadIcon(AfxGetResourceHandle(),MAKEINTRESOURCE(IDI_ICON2)));
mImageList.Add(LoadIcon(AfxGetResourceHandle(),MAKEINTRESOURCE(IDI_ICON3)));
mImageList.Add(LoadIcon(AfxGetResourceHandle(),MAKEINTRESOURCE(IDI_ICON1)));
mTree.SetImageList(&mImageList,TVSIL_NORMAL);
HTREEITEM hRoot = mTree.InsertItem(_T("根"),0,0);
HTREEITEM hL0_0 = mTree.InsertItem(_T("层0-0"),1,1,hRoot);
mTree.InsertItem(_T("层1-0"),2,2,hL0_0);
mTree.InsertItem(_T("层1-1"),2,2,hL0_0);
mTree.InsertItem(_T("层1-2"),2,2,hL0_0);
mTree.InsertItem(_T("层1-3"),2,2,hL0_0);
HTREEITEM hL0_1 = mTree.InsertItem(_T("层0-1"),1,1,hRoot);
mTree.InsertItem(_T("层1-0"),2,2,hL0_1);
mTree.InsertItem(_T("层1-1"),2,2,hL0_1);
mTree.InsertItem(_T("层1-2"),2,2,hL0_1);
树形控件
最新推荐文章于 2024-10-07 10:09:39 发布