How to Merge two or more CImageList objects to a single one
-
Dear all, I have, CImageList ImgList1; CImageList ImgList2; CImageList MasterImgList; I have added several "CBitMap" objects to the "ImgList1" and "ImgList2" using CImageList::Add( CBitmap* pbmImage, COLORREF crMask ) method. Now I would Like to Merge "ImgList1" and "ImgList2" to the "MasterImgList". That is after merging, "MasterImgList" contains both the contents of "ImgList1" and ImgList2". Please help me.. Thanks in Advance George K Jolly
-
Dear all, I have, CImageList ImgList1; CImageList ImgList2; CImageList MasterImgList; I have added several "CBitMap" objects to the "ImgList1" and "ImgList2" using CImageList::Add( CBitmap* pbmImage, COLORREF crMask ) method. Now I would Like to Merge "ImgList1" and "ImgList2" to the "MasterImgList". That is after merging, "MasterImgList" contains both the contents of "ImgList1" and ImgList2". Please help me.. Thanks in Advance George K Jolly
georgekjolly wrote:
Now I would Like to Merge "ImgList1" and "ImgList2" to the "MasterImgList".
why CImageList:: ( Add, Copy, Remove, Replace) member functions can't be used to achieve the image list merge.
-
Dear all, I have, CImageList ImgList1; CImageList ImgList2; CImageList MasterImgList; I have added several "CBitMap" objects to the "ImgList1" and "ImgList2" using CImageList::Add( CBitmap* pbmImage, COLORREF crMask ) method. Now I would Like to Merge "ImgList1" and "ImgList2" to the "MasterImgList". That is after merging, "MasterImgList" contains both the contents of "ImgList1" and ImgList2". Please help me.. Thanks in Advance George K Jolly
Try using CImageList::GetImageInfo() to get the HBITMAP handles for the bitmap and mask of the imagelist you want to add. With those handles, you can make the CBitmap objects to use in a call to CImageList::Add(). Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
Try using CImageList::GetImageInfo() to get the HBITMAP handles for the bitmap and mask of the imagelist you want to add. With those handles, you can make the CBitmap objects to use in a call to CImageList::Add(). Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
Hi Mark, Thank you for your reply. You mean, extracting BitMap from CImageList and adding it to the Master Image List.. But will it make any overhead ? Or Can we achieve the merging of ImageLists using some other methods like Copy.. Thanks George K Jolly
-
Hi Mark, Thank you for your reply. You mean, extracting BitMap from CImageList and adding it to the Master Image List.. But will it make any overhead ? Or Can we achieve the merging of ImageLists using some other methods like Copy.. Thanks George K Jolly
It wouldn't really be "extracting" the bitmaps from the imagelist since bitmap(s) are part of an image list already. What I described is more of a copy and add. Sure there's overhead - there's overhead doing anything. Whether it's detrimental to the performance of your app or not depends on how often you do it. e.g. Thousands of times a second...You could do better managing bitmap memory yourself :) The most overhead probably involves creating a new bitmap, copying the original bitmap, then the copy from the second imagelist bitmap. It's still more efficient than adding one image at a time, which is what imagelists are best suited for (in their available functionality). I don't know of a copy operation that copies one imagelist to another. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java: