Click here to Skip to main content
11,805,604 members (46,748 online)
Click here to Skip to main content

How to use 32 bit icons in CTreeCtrl

, 6 Jul 2006 CPOL 68.3K 2.8K 37
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

You may also be interested in...

Comments and Discussions

GeneralMy vote of 1 Pin
CDXMoto21-Oct-13 12:28
memberCDXMoto21-Oct-13 12:28 
Generalwhy same process doesn't work in 2005 Pin
Member 312032417-Mar-10 21:32
memberMember 312032417-Mar-10 21:32 
Rantit is not 32 bit images Pin
vaadim25-Jul-09 2:31
membervaadim25-Jul-09 2:31 
GeneralMy vote of 1 Pin
vaadim25-Jul-09 2:30
membervaadim25-Jul-09 2:30 
GeneralIf you need transparent images... Pin
johnnyk427724-Jun-08 1:24
memberjohnnyk427724-Jun-08 1:24 
GeneralGood job! Pin
Member 13044565-May-08 23:31
memberMember 13044565-May-08 23:31 
QuestionHow to control the ctreectrol's WS_HSCROLL style Pin
VS_Study7-Apr-08 22:54
memberVS_Study7-Apr-08 22:54 
QuestionI want to change size of treeitem image at run time.Is it possible? Pin
tupipatel25-Feb-08 23:07
membertupipatel25-Feb-08 23:07 
Questiondosen't works. Pin
Ragesh C5-Nov-06 14:31
memberRagesh C5-Nov-06 14:31 
AnswerRe: dosen't works. Pin
Le Sourcier9-Nov-06 2:38
memberLe Sourcier9-Nov-06 2:38 
Questiondosen't works. Pin
Ragesh C5-Nov-06 14:29
memberRagesh C5-Nov-06 14:29 
Generalit doesn't worked Pin
Ragesh C5-Nov-06 14:23
memberRagesh C5-Nov-06 14:23 
Question32Bit Bitmap - how? Pin
Michael E. Jones9-Jul-06 22:43
memberMichael E. Jones9-Jul-06 22:43 
AnswerRe: 32Bit Bitmap - how? Pin
Le Sourcier10-Jul-06 9:40
memberLe Sourcier10-Jul-06 9:40 
QuestionRe: 32Bit Bitmap - how? Pin
Michael E. Jones10-Jul-06 22:24
memberMichael E. Jones10-Jul-06 22:24 
AnswerRe: 32Bit Bitmap - how? Pin
vaadim25-Jul-09 2:34
membervaadim25-Jul-09 2:34 
JokeRe: 32Bit Bitmap - how? Pin
Michael E. Jones25-Jul-09 2:42
memberMichael E. Jones25-Jul-09 2:42 
GeneralGood reminder ! Pin
Kochise7-Jul-06 21:48
memberKochise7-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 | Terms of Use | Mobile
Web04 | 2.8.151002.1 | Last Updated 7 Jul 2006
Article Copyright 2006 by Le Sourcier
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid