How can I set Metatreex node iamge in VC++

Author Message
Brade 02/06/2006 07:51 am
Now I can change the background of the Metatree by using class CPictureHolder.But it seems too hard to set the nodes image.How can I set the param of Metatree.setimagelist().Would you be so kind to tell me what the IUnknown param should be.It would be better to get an VC demo.
Thank you all!
Oleg Chernavin 02/07/2006 06:07 am
Can you please tell us how you create the component in VC++ and how did you try to assign the images? We will try to reproduce this and make a recommendation.

Thank you!

Best regards,
Oleg Chernavin
MP Staff
brade 02/09/2006 01:29 am
Make an dialog resouce,add a Metatreex control to the dialog.
May be the following codes would be enough to you!
//metatree is a metatreex type member param of MyView

CMTitems items=metatree.GetItems();
CMTitem item=items.insert(0,"root");
//use CPictureHolder class to set the background
CPictureHolder mypic;
LPDISPATCH pdisp=mypic.getdispatch();
//ID_BITMAP is my bitmap ID

//I just don`t know how to set the Imagelist for the nodes. Such as root ,child0,child1.
//that is how to set the param of the member funtion: SetImagelist(Iunknow newvalue);
In VB demo you set the imagelist for the metatree like this:

Set Images = CreateObject("MSComctlLib.ImageListCtrl")
Images.ImageHeight = 32
Images.ImageWidth = 32
Images.MaskColor = &HFF00FF
Set Pict = LoadPicture("MXDemo.bmp")
Images.ListImages.Add 1, , Pict
MetaTreeX1.SetImageList Images

How can I make it in VC++

surpose ID_MYIMAGELIST is my imagelist can I load the imagelist and set the nodes iamge.
Using SetImagelist() function?How to set the param of the function!
or other ways?

Thank you for your attention.

Oleg Chernavin 02/10/2006 07:42 am
I think, we will need to add a function for image lists. Can you please wait a week until this is done?

brade 02/10/2006 09:26 pm
Thank you for your kindness.
Best wishes!
Alex Filatkin 03/05/2006 12:33 pm
Dear Brade,

We are very sorry for long delay.

This example demonstrates how to set imagelist in VC++.
So, please note that i am not experience in VC++ and my codes may contain some mistakes
// load images from resources
CPictureHolder mypic2;
LPDISPATCH pdisp2=mypic2.GetPictureDispatch();

IImageList il;
IImages ii;
ii = il.GetListImages();
v1.vt = VT_INT;
v1.intVal = 1;
v2.vt = VT_DISPATCH;
v2.pdispVal = pdisp2;

// add images to imagelist
ii.Add(&v1, NULL, &v2);

// set imagelis "il" to m_metatree


IImageList and IImages classes i created by ClassWizard->Add Class -> From a type library MSCOMCTL.OCX

Sincerely yours,
Alex Filatkin
MP Staff