Treeview control (加入图标)运用
来源:互联网 发布:mac远程桌面在哪里 编辑:程序博客网 时间:2024/04/29 21:34
case WM_INITDIALOG:// 创建TreeView控件INITCOMMONCONTROLSEX icc = {sizeof(icc), ICC_TREEVIEW_CLASSES};if(InitCommonControlsEx(&icc)){HWND hTreeView = CreateWindow(_T("SysTreeView32"),_T("TreeView"),WS_CHILD | WS_VISIBLE | WS_BORDER | TVS_FULLROWSELECT | TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT,5, 5, 250, 700, hDlg, (HMENU)0x11,hInstX,NULL);TVINSERTSTRUCT ti = {0};HTREEITEM hParent,Parent;HIMAGELIST himl; //加入图标himl=ImageList_Create(16,16,ILC_COLOR32,1,12);ImageList_Add(himl,LoadBitmap(hInstX,MAKEINTRESOURCE(IDB_TREE)),NULL);SendMessage(hTreeView,TVM_SETIMAGELIST,TVSIL_NORMAL,(LPARAM)himl);ti.item.mask=TVIF_TEXT|TCIF_IMAGE|TVIF_SELECTEDIMAGE;ti.item.iImage=4;ti.item.iSelectedImage=4;ti.item.pszText=_T("127.0.0.1: C0400");ti.hParent=NULL;ti.hInsertAfter=TVI_ROOT;Parent=hParent=(HTREEITEM)SendMessage(hTreeView,TVM_INSERTITEM,0,(LPARAM)&ti);ti.hParent=hParent;ti.hInsertAfter=TVI_LAST;//TVI_LAST表示节点添加在最后ti.item.iImage=5;ti.item.iSelectedImage=5;ti.item.pszText=_T("Slot0");hParent=(HTREEITEM)SendMessage(hTreeView,TVM_INSERTITEM,0,(LPARAM)&ti);ti.hParent=hParent;ti.hInsertAfter=TVI_LAST;//TVI_LAST表示节点添加在最后ti.item.iImage=3;ti.item.iSelectedImage=3;ti.item.pszText="port0";SendMessage(hTreeView,TVM_INSERTITEM,0,(LPARAM)&ti);ti.hParent=hParent;ti.hInsertAfter=TVI_LAST;//TVI_LAST表示节点添加在最后ti.item.iImage=3;ti.item.iSelectedImage=3;ti.item.pszText="port1";SendMessage(hTreeView,TVM_INSERTITEM,0,(LPARAM)&ti);ti.hParent=hParent;ti.hInsertAfter=TVI_LAST;//TVI_LAST表示节点添加在最后ti.item.iImage=3;ti.item.iSelectedImage=3;ti.item.pszText="port2";SendMessage(hTreeView,TVM_INSERTITEM,0,(LPARAM)&ti);ti.hParent=hParent;ti.hInsertAfter=TVI_LAST;//TVI_LAST表示节点添加在最后ti.item.iImage=3;ti.item.iSelectedImage=3;ti.item.pszText="port3";SendMessage(hTreeView,TVM_INSERTITEM,0,(LPARAM)&ti);ti.hParent=Parent;ti.hInsertAfter=TVI_LAST;//TVI_LAST表示节点添加在最后ti.item.iImage=5;ti.item.iSelectedImage=5;ti.item.pszText=_T("Slot1");hParent=(HTREEITEM)SendMessage(hTreeView,TVM_INSERTITEM,0,(LPARAM)&ti);ti.hParent=hParent;ti.hInsertAfter=TVI_LAST;//TVI_LAST表示节点添加在最后ti.item.iImage=3;ti.item.iSelectedImage=3;ti.item.pszText="port0";SendMessage(hTreeView,TVM_INSERTITEM,0,(LPARAM)&ti);ti.hParent=hParent;ti.hInsertAfter=TVI_LAST;//TVI_LAST表示节点添加在最后ti.item.iImage=3;ti.item.iSelectedImage=3;ti.item.pszText="port1";SendMessage(hTreeView,TVM_INSERTITEM,0,(LPARAM)&ti);ti.hParent=hParent;ti.hInsertAfter=TVI_LAST;//TVI_LAST表示节点添加在最后ti.item.iImage=3;ti.item.iSelectedImage=3;ti.item.pszText="port2";SendMessage(hTreeView,TVM_INSERTITEM,0,(LPARAM)&ti);ti.hParent=hParent;ti.hInsertAfter=TVI_LAST;//TVI_LAST表示节点添加在最后ti.item.iImage=3;ti.item.iSelectedImage=3;ti.item.pszText="port3";SendMessage(hTreeView,TVM_INSERTITEM,0,(LPARAM)&ti);
结果如下:
- Treeview control (加入图标)运用
- wxWidget的tree control和加入图标(icon)
- About TreeView Control
- Csharp: TreeView Control
- Csharp: TreeView Control
- TreeView代码加入数据
- sublime3,加入Package Control
- IE Web Control (Treeview)配置
- Separating AutoPostBack Functionality TreeView control
- DataGrid中加入图标
- 运用treeview显示本地硬盘目录
- Windows窗体资源管理器Treeview运用
- 字体图标的运用
- 关于TreeView中添加图标
- TreeView 图标不能显示问题
- List Control and Icons(列表控件加图标)
- LVITEM 列表视图控件(List Control) 显示图标
- C++/MFC-List Control(图标、报表、列表)风格
- awk常用命令
- RIA ajax 第一篇
- android 之 线程间的通信
- 生命周期
- 第一个JMS程序_JMS学习
- Treeview control (加入图标)运用
- 等值首尾和
- 如何完全的删除Mysql
- eclipse鼠标悬浮提示过快 tooltip推迟 的问题解决办法。
- Windows下编译memcached-1.4.5(32bit和64bit) .
- 网页PNG图片不显示
- 在MFC中,发送并处理自定义消息
- SQL 基础6—— 子查询
- DIV+CSS相对IE6、IE7和IE8的兼容问题