1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
hTree = CreateWindowEx(0,WC_TREEVIEW,_T(""),WS_VISIBLE|WS_CHILD|WS_BORDER|WS_HSCROLL | WS_VSCROLL |TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS
,0,45,216,532,hWnd,NULL,hInst,NULL);
HBITMAP hbimp;
HIMAGELIST imagList;
imagList = ImageList_Create(16, 16, ILC_COLOR, 4,10);
hbimp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_BITMAP2));
ImageList_AddMasked(imagList, hbimp,crMask);
SendMessage(hTree, TB_SETIMAGELIST, 0, (LPARAM)(HIMAGELIST)imagList);
HTREEITEM Parent;
TV_INSERTSTRUCT tvinsert;
tvinsert.hParent=NULL;
tvinsert.hInsertAfter=TVI_ROOT;
tvinsert.item.mask=TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
tvinsert.item.pszText = _T("Map");
tvinsert.item.iImage=0;
tvinsert.item.iSelectedImage=1;
Parent=TreeView_InsertItem(hTree, &tvinsert);
if (Parent == NULL)
{
DestroyWindow(hTree);
MessageBox(NULL, _T("Couldn't add TreeView"), _T("Tab Example"), MB_OK | MB_ICONERROR);
exit(1);
}
|