CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2010
    Posts
    2

    CBitmap extracting from CImageListome icon can mot be resized

    Dear all:

    I am trying to find a way to copy and individual image from a CImageList to a CBitmap object,

    and refer http://www.codeguru.com/forum/archiv.../t-257564.html

    I success do this work.

    But I have another problem....Orz.

    Some icons of file like .rar or .zip file can not be resized. As below

    CImageList *mm_imglist;
    mm_imglist = m_pList->GetImageList(LVSIL_SMALL);
    IMAGEINFO imageinfo;
    mm_imglist->GetImageInfo(1, &imageinfo);
    CDC dcMem;
    dcMem.CreateCompatibleDC (&dc);
    CRect rect (imageinfo.rcImage);
    CBitmap bmp;
    bmp.CreateCompatibleBitmap (&dc, 100, 100);
    CBitmap* pBmpOld = dcMem.SelectObject (&bmp);
    mm_imglist->DrawIndirect (&dcMem, rItem.iImage, CPoint (0, 0), CSize (100, 100), CPoint (0, 0));
    dc.BitBlt(50,0,100,100,&dcMem,0,0,SRCCOPY);

    Some Icons show as original size not size 100*100. I check these files that show original size

    icon and find several diference icons are included in these files.

    Please help me.....thanks all.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: CBitmap extracting from CImageListome icon can mot be resized

    What is m_pList?
    Does the image with the index 1 exist?
    Victor Nijegorodov

  3. #3
    Join Date
    Apr 2010
    Posts
    2

    Re: CBitmap extracting from CImageListome icon can mot be resized

    m_pList is ---> CListCtrl* m_pList;

    And mm_imglist->GetImageInfo(1, &imageinfo) should be

    mm_imglist->GetImageInfo(0, &imageinfo), sorry I forget to fix it.

    And there is only one item in m_pList.

    I make a program that drop&drag file into my application and show the file icon in the window

    But if the file have several difference icons in its .exe. I can extract its icon but can't resize.



     

Tags for this Thread

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