Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to Merge two or more CImageList objects to a single one

How to Merge two or more CImageList objects to a single one

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorial
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    georgekjolly
    wrote on last edited by
    #1

    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

    R M 2 Replies Last reply
    0
    • G georgekjolly

      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

      R Offline
      R Offline
      Rajkumar R
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • G georgekjolly

        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

        M Offline
        M Offline
        Mark Salsbery
        wrote on last edited by
        #3

        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:

        G 1 Reply Last reply
        0
        • M Mark Salsbery

          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:

          G Offline
          G Offline
          georgekjolly
          wrote on last edited by
          #4

          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

          M 1 Reply Last reply
          0
          • G georgekjolly

            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

            M Offline
            M Offline
            Mark Salsbery
            wrote on last edited by
            #5

            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:

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups