Click here to Skip to main content
13,356,787 members (67,099 online)
Click here to Skip to main content
Add your own
alternative version

Stats

79.3K views
3.2K downloads
37 bookmarked
Posted 6 Jul 2006

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.

Introduction

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_bitmap.LoadBitmap(IDB_BITMAP_HIGHCOLOR);
m_imageList.Add(&m_bitmap, RGB(255,0,255));

//Manage your tree items......
m_tree.SetImageList (&m_imageList, TVSIL_NORMAL);
m_tree.InsertItem("RootItem",0,0,TVI_ROOT);

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

That's all !!!!

License

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

Share

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#
- ASP.NET
- C and assembly

Have lot of fun

You may also be interested in...

Pro
Pro

Comments and Discussions

 
GeneralMy vote of 1 Pin
CDXMoto21-Oct-13 13:28
memberCDXMoto21-Oct-13 13:28 
Generalwhy same process doesn't work in 2005 Pin
Member 312032417-Mar-10 22:32
memberMember 312032417-Mar-10 22:32 
Rantit is not 32 bit images Pin
vaadim25-Jul-09 3:31
membervaadim25-Jul-09 3:31 
GeneralMy vote of 1 Pin
vaadim25-Jul-09 3:30
membervaadim25-Jul-09 3:30 
GeneralIf you need transparent images... Pin
johnnyk427724-Jun-08 2:24
memberjohnnyk427724-Jun-08 2:24 
GeneralGood job! Pin
Member 13044566-May-08 0:31
memberMember 13044566-May-08 0:31 
QuestionHow to control the ctreectrol's WS_HSCROLL style Pin
VS_Study7-Apr-08 23:54
memberVS_Study7-Apr-08 23:54 
QuestionI want to change size of treeitem image at run time.Is it possible? Pin
tupipatel26-Feb-08 0:07
membertupipatel26-Feb-08 0:07 
Questiondosen't works. Pin
Ragesh C5-Nov-06 15:31
memberRagesh C5-Nov-06 15:31 
AnswerRe: dosen't works. Pin
Le Sourcier9-Nov-06 3:38
memberLe Sourcier9-Nov-06 3:38 
Questiondosen't works. Pin
Ragesh C5-Nov-06 15:29
memberRagesh C5-Nov-06 15:29 
Generalit doesn't worked Pin
Ragesh C5-Nov-06 15:23
memberRagesh C5-Nov-06 15:23 
Question32Bit Bitmap - how? Pin
Michael E. Jones9-Jul-06 23:43
memberMichael E. Jones9-Jul-06 23:43 
AnswerRe: 32Bit Bitmap - how? Pin
Le Sourcier10-Jul-06 10:40
memberLe Sourcier10-Jul-06 10:40 
QuestionRe: 32Bit Bitmap - how? Pin
Michael E. Jones10-Jul-06 23:24
memberMichael E. Jones10-Jul-06 23:24 
AnswerRe: 32Bit Bitmap - how? Pin
vaadim25-Jul-09 3:34
membervaadim25-Jul-09 3:34 
JokeRe: 32Bit Bitmap - how? Pin
Michael E. Jones25-Jul-09 3:42
memberMichael E. Jones25-Jul-09 3:42 
GeneralGood reminder ! Pin
Kochise7-Jul-06 22:48
memberKochise7-Jul-06 22:48 

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

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

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.180111.1 | Last Updated 7 Jul 2006
Article Copyright 2006 by Le Sourcier
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid