Thank you all!
Thank you!
Best regards,
Oleg Chernavin
MP Staff
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");
intems.add(item,"child0");
intems.add(item,"child1");
//use CPictureHolder class to set the background
CPictureHolder mypic;
mypic.CreateFromBitmap(ID_BITMAP);
LPDISPATCH pdisp=mypic.getdispatch();
metatree.setbackground(pdisp);
//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 id.how 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.
Best wishes!
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;
mypic2.CreateFromBitmap(IDB_BITMAP4);
LPDISPATCH pdisp2=mypic2.GetPictureDispatch();
IImageList il;
IImages ii;
il.CreateDispatch("MSComctlLib.ImageListCtrl");
il.SetImageHeight(32);
il.SetImageWidth(32);
ii = il.GetListImages();
VARIANT v1;
VariantInit(&v1);
v1.vt = VT_INT;
v1.intVal = 1;
VARIANT v2;
VariantInit(&v2);
v2.vt = VT_DISPATCH;
v2.pdispVal = pdisp2;
// add images to imagelist
ii.Add(&v1, NULL, &v2);
// set imagelis "il" to m_metatree
m_metatree.SetImageList(il);
VariantClear(&v2);
VariantClear(&v1);
===
IImageList and IImages classes i created by ClassWizard->Add Class -> From a type library MSCOMCTL.OCX
Sincerely yours,
Alex Filatkin
MP Staff