-
April 12th, 2011, 11:26 PM
#1
MFC Tree Control: How to add multiple icons to a tree control item?
Hi,
I am trying to display multiple icons to the treeview item but it is not displaying all the icons, it displays only one.
I am using CImageList m_imageState;
m_cTree.m_imageState.Create(16, 16, ILC_MASK, 0, 4);
m_cTree.m_imageState.Add(&bm, RGB(255,255,0));
m_cTree.m_imageState.Add(&bm2, RGB(255,0,255));
m_cTree.m_imageState.Add(&bm, RGB(255,255,0));
m_cTree.m_imageState.Add(&bm1, RGB(0,255,255));
But when i see treeview item it displays only one icon.
Is it possible to display multiple icons with treeview item?
Please suggest how can i do this.
Thanks
-
April 13th, 2011, 12:15 AM
#2
Re: MFC Tree Control: How to add multiple icons to a tree control item?
Hi,
I am trying to display multiple icons to the Treeview item but it is not displaying all the icons, it displays only one.
I am using CImageList m_imageState;
m_cTree.m_imageState.Create(16, 16, ILC_MASK, 0, 4);
m_cTree.m_imageState.Add(&bm, RGB(255,255,0));
m_cTree.m_imageState.Add(&bm2, RGB(255,0,255));
m_cTree.m_imageState.Add(&bm, RGB(255,255,0));
m_cTree.m_imageState.Add(&bm1, RGB(0,255,255));
m_cTree.SetImageList( &(m_cTree.m_imageState), TVSIL_NORMAL );
But when I see Treeview, item displays only one icon.
Is it possible to display multiple icons with Treeview item?
Please suggest how can i do this.
Thanks
-
April 13th, 2011, 01:22 AM
#3
Re: MFC Tree Control: How to add multiple icons to a tree control item?
You can use two images: "normal: and "state". To implement state images you have to set the TVSIL_STATE image list. (The state images are usually used as the check marks for the control with TVS_CHECKBOXES style)
Victor Nijegorodov
-
April 13th, 2011, 01:42 AM
#4
Re: MFC Tree Control: How to add multiple icons to a tree control item?
Originally Posted by VictorN
You can use two images: "normal: and "state". To implement state images you have to set the TVSIL_STATE image list. (The state images are usually used as the check marks for the control with TVS_CHECKBOXES style)
I have tried with the TVSIL_STATE and it displays the check boxes but this change still doesn't display multiple images at tree view item.
-
April 13th, 2011, 01:52 AM
#5
Re: MFC Tree Control: How to add multiple icons to a tree control item?
Then you will have to use custom draw and draw the whole control yourself.
Victor Nijegorodov
-
April 13th, 2011, 02:12 AM
#6
Re: MFC Tree Control: How to add multiple icons to a tree control item?
Originally Posted by VictorN
Then you will have to use custom draw and draw the whole control yourself.
Thanks for your reply....
My treeview could contain thousand of items and each tree view item can contain multiple images.
I can draw the individual icons into a bitmap in memory, then load that bitmap into the ImageList.
But In this scenario I feel that drawing the treeview with custom draw would be a very costly operation???
your suggestion please??
-
April 13th, 2011, 02:44 AM
#7
Re: MFC Tree Control: How to add multiple icons to a tree control item?
Originally Posted by sisodia.nikhil
... I feel that drawing the treeview with custom draw would be a very costly operation???
No, unless you will do something wrong.
It doesn't matter who will provide drawing: you yourself or the Windows for you.
Victor Nijegorodov
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|