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
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
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)
Re: MFC Tree Control: How to add multiple icons to a tree control item?
Quote:
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.
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.
Re: MFC Tree Control: How to add multiple icons to a tree control item?
Quote:
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??
Re: MFC Tree Control: How to add multiple icons to a tree control item?
Quote:
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.