Ctreectrl + cimagelist Application

Source: Internet
Author: User

1. Define a cimagelist m_imagelist;

Ii. initialize and load the image list:

m_imagelist.create (18, 18, ilc_colorddb | ilc_mask, 0, 1);
cbitmap camer;
cbitmap camerg;
camer. loadbitmap (idb_video);
camerg. loadbitmap (idb_videogroup);
m_imagelist.add (& camerg, RGB (192,192,192);
m_imagelist.add (& camer, RGB (192,192,192 ));
m_treelist.setimagelist (& m_imagelist, tvsil_normal);

DWORD dwstyles = getwindowlong (m_treelist.m_hwnd, gwl_style );
Dwstyles | = tvs_hasbuttons | tvs_haslines | tvs_linesatroot | tvs_editlabels;
Setwindowlong (m_treelist.m_hwnd, gwl_style, dwstyles );

Htreeitem hitem, hsubitem;  
Hitem = m_treelist.insertitem ("parent1", tvi_root, tvi_last );  
// Add parent1 to the root node  
Hsubitem = NULL;
Hsubitem = m_treelist.insertitem ("child1_1", 1, 1, hitem, hsubitem );
// Add a subnode on parent1  
Hsubitem = m_treelist.insertitem ("child1_2", 1, 1, hitem, hsubitem );
// Add a subnode on parent1, which is behind child1_1  
Hsubitem = m_treelist.insertitem ("child1_3", 1, 1, hitem, hsubitem );  
M_treelist.expand (hitem, tve_expand );
Hitem = m_treelist.insertitem ("parent2", tvi_root, hitem );  
Hitem = m_treelist.insertitem ("parent3", tvi_root, hitem );

 

 

From: http://blog.csdn.net/wny198816/article/details/6996043

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.