Click here to Skip to main content
Click here to Skip to main content

How to use 32 bit icons in CTreeCtrl

, 6 Jul 2006
Rate this:
Please Sign up or sign in to vote.
This article explains how to use 32 bit icons in a CTreeCtrl.


This article explains how to use high colored icons with the common control, CTreeCtrl.

This is done in just four lines of code!!!

Sample image

How To

In your dialog class header, just add two attributes:

CImageList m_imageList; //image list used by the tree
CBitmap m_bitmap; //bitmap witch loads 32bits bitmap

At the end of InitDialog:

// Create a 32bits ImageList
m_imageList.Create (16, 16, ILC_COLOR32 , 1,1);

//Add the bitmap to the ImageList
m_imageList.Add(&m_bitmap, RGB(255,0,255));

//Manage your tree items......
m_tree.SetImageList (&m_imageList, TVSIL_NORMAL);

This is a very easy way to making a good rendering with VC++ 6.0.

That's all !!!!


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Le Sourcier
Software Developer ECT Industries
France France
I am software engineer and I work for the aviation.
I'm currently working on many different project and in many different languages
- Visual C++ 6
- C#
- C and assembly
Have lot of fun

Comments and Discussions

GeneralMy vote of 1 PinmemberCDXMoto21-Oct-13 12:28 
Generalwhy same process doesn't work in 2005 PinmemberMember 312032417-Mar-10 21:32 
Rantit is not 32 bit images Pinmembervaadim25-Jul-09 2:31 
GeneralMy vote of 1 Pinmembervaadim25-Jul-09 2:30 
GeneralIf you need transparent images... Pinmemberjohnnyk427724-Jun-08 1:24 
GeneralGood job! PinmemberMember 13044565-May-08 23:31 
QuestionHow to control the ctreectrol's WS_HSCROLL style PinmemberVS_Study7-Apr-08 22:54 
QuestionI want to change size of treeitem image at run time.Is it possible? Pinmembertupipatel25-Feb-08 23:07 
Questiondosen't works. PinmemberRagesh C5-Nov-06 14:31 
AnswerRe: dosen't works. PinmemberLe Sourcier9-Nov-06 2:38 
Questiondosen't works. PinmemberRagesh C5-Nov-06 14:29 
Generalit doesn't worked PinmemberRagesh C5-Nov-06 14:23 
Question32Bit Bitmap - how? PinmemberMichael E. Jones9-Jul-06 22:43 
AnswerRe: 32Bit Bitmap - how? PinmemberLe Sourcier10-Jul-06 9:40 
QuestionRe: 32Bit Bitmap - how? PinmemberMichael E. Jones10-Jul-06 22:24 
AnswerRe: 32Bit Bitmap - how? Pinmembervaadim25-Jul-09 2:34 
JokeRe: 32Bit Bitmap - how? PinmemberMichael E. Jones25-Jul-09 2:42 
GeneralGood reminder ! PinmemberKochise7-Jul-06 21:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 7 Jul 2006
Article Copyright 2006 by Le Sourcier
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid