CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Aug 2000
    Posts
    1,471

    How to merge two image lists?

    For example, I have two image lists CImageList il1 and CImageList il2. I want to merge them into one image list? How can I do that? Thanks for your inputs.

  2. #2
    Join Date
    Feb 2002
    Posts
    4,640

    Re: How to merge two image lists?

    It looks like there's an overload for Create that might do just that:
    Code:
    BOOL Create(
       CImageList& imagelist1,
       int nImage1,
       CImageList& imagelist2,
       int nImage2,
       int dx,
       int dy 
    );
    Check out the MSDN:
    http://msdn.microsoft.com/library/de...a3a.create.asp

    Viggy

  3. #3
    Join Date
    Aug 2000
    Posts
    1,471

    Re: How to merge two image lists?

    Thanks for your reply. The function Create is a MFC function but I am working with ATL. There is not similar overload in ATL for Create. Any idea how to do that in ATL? Thanks a lot.
    Quote Originally Posted by MrViggy
    It looks like there's an overload for Create that might do just that:
    Code:
    BOOL Create(
       CImageList& imagelist1,
       int nImage1,
       CImageList& imagelist2,
       int nImage2,
       int dx,
       int dy 
    );
    Check out the MSDN:
    http://msdn.microsoft.com/library/de...a3a.create.asp

    Viggy

  4. #4
    Join Date
    Feb 2002
    Posts
    4,640

    Re: How to merge two image lists?

    I don't see a CImageList in the ATL reference. Are you really using an MFC CImageList, or did you roll your own?

    Viggy

  5. #5
    Join Date
    Aug 2000
    Posts
    1,471

    Re: How to merge two image lists?

    ATL does have CImageList and It is under ATLControls namespace but somehow ATL is poorly documented. That is why you didn't see a CImageList in the ATL reference.
    Quote Originally Posted by MrViggy
    I don't see a CImageList in the ATL reference. Are you really using an MFC CImageList, or did you roll your own?

    Viggy

  6. #6
    Join Date
    Feb 2002
    Posts
    4,640

    Re: How to merge two image lists?

    Hmm, okay, I haven't really dabbled in ATL, however the MFC version of "Create" is just:
    Code:
    BOOL CImageList::Create(CImageList& imagelist1, int nImage1,
    	CImageList& imagelist2, int nImage2, int dx, int dy)
    {
    	return Attach(ImageList_Merge(imagelist1.m_hImageList, nImage1,
    		imagelist2.m_hImageList, nImage2, dx, dy));
    }
    And, 'ImageList_Merge' looks like it's just an API call (in 'commctrl.h'):
    Code:
    WINCOMMCTRLAPI HIMAGELIST  WINAPI ImageList_Merge(HIMAGELIST himl1, int i1, HIMAGELIST himl2, int i2, int dx, int dy);
    HTH...

    Viggy

  7. #7
    Join Date
    Feb 2002
    Posts
    4,640

    Re: How to merge two image lists?

    And, just to add to my last post:

    http://msdn.microsoft.com/library/de...list_merge.asp

    Viggy

  8. #8
    Join Date
    Jun 2013
    Posts
    2

    Re: How to merge two image lists?

    i think you'd better roll your own to c# merge image lists. this version of codes work well for me. but i have no idea how to do this in atl.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured