关于CImageList,我有几个问题:
1)一般的创建图象列表资源都是横向的图,对于垂直方向的图怎么创建呢?
2)一行的图象资源很容易创建到图象列表中,对于多行多列的图如何创建成图象列表呢?
3)怎样把两个图象列表连起来?我试验了CImageList::Copy函数,按照MSDN上的做,
结果不能实现把其中一个列表中的图象单元附加到另外一个之中请大家指点一下,最好有示例代码,谢谢先

解决方案 »

  1.   

    1)没有所谓的垂直方向的图象列表
    2)也没有所谓的多行多列的图象列表
    3) 连接2个imagelist。 
       试试:
       CImageList tmpList;
       tmpList.Create( imglist1,0,imglist2,0, 0,0 );//后面2个参数,不晓得。你可以查一下msdn
      

  2.   

    BOOL Create( CImageList& imagelist1, int nImage1, CImageList& imagelist2, int nImage2, int dx, int dy );nImage2Index of the second existing image.dxOffset of the x-axis of the second image in relationship to the first image, in pixels.dyOffset of the y-axis of the second image in relationship to the first image, in pixels.
      

  3.   

    BOOL Copy( int iDst, CImageList* pSrc, int iSrc, UINT uFlags = ILCF_MOVE );Example// The pointer to my image list.
    extern CImageList* pmyImageList;
    // The pointer to another image list.
    extern CImageList* pmyImageList2;// Copy the first image from pmyImageList2 and make it
    // the first image of pmyImageList.
    pmyImageList->Copy(0, pmyImageList2, 0, ILCF_MOVE);// Recopy the new image of pmyImageList to make it also 
    // the last image in pmyImageList.
    // Recopy the image to make it also the last image in pmyImageList.
    pmyImageList->Copy(pmyImageList->GetImageCount()-1,
        (UINT) 0, ILCF_MOVE);
      

  4.   

    垂直方向和多行多列的意思是图像是横向可以分成一个或多个图元,垂直方向也是一个或多个图元的如果都做成横向的那就超长了,而且可能超过VC开发环境的大小要求上面的那个COPY讲解是MSDN中的原话,可我试过根本不能成功,代码如下:
    //m_Imglst.Create(IDB_BMP1,100,2,RGB(0,0,0));
    CImageList *img1;
    img1=new CImageList;
    img1->Create(IDB_BMP2,100,0,RGB(0,0,0));
    //m_Imglst.SetImageCount(50);
    for(int j=0;j<img1->GetImageCount();j++)
    {
    m_Imglst.Copy(j,img1,j,ILCF_SWAP);//ILCF_MOVE也试过,不行
    }
    然后检查没有拷贝成功..
      

  5.   

    知道List的意思吗?就是数据结构中的链表,一维的,无所谓垂直、横向。如果你真有这么大的一个图像列表(32位索引是多少?),可以拆分成几个图像列表啊,用数组管理。链接图像列表,可以从一个图像列表中用GetImageInfo()取出位图,然后Add()到另外一个中。
      

  6.   

    为什么我的CImageList不能用?
    1.在类中声明变量:
      CImageList m_ImgList;
    2. 在类的一个初始化函数(是其它地方手工调用的)里:
       
    HBITMAP hBitmap = (HBITMAP)::LoadImage( AfxGetInstanceHandle(), _T("im1.bmp"), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE );
    if ( hBitmap == NULL )
    return;
    CBitmap *pIcon = CBitmap::FromHandle( hBitmap );
    hBitmap = (HBITMAP)::LoadImage( AfxGetInstanceHandle(), _T("im2.bmp"), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE );
    if ( hBitmap == NULL )
    return;
    CBitmap *pIconMask = CBitmap::FromHandle( hBitmap );
    CSize size = pIcon->GetBitmapDimension();
    m_ImgList.Create( size.cx, size.cy, ILC_COLOR, 5, 1 );   // 这一句要不要一个样
    m_ImgList.Add( pIcon, pIconMask );   // 这一句总是出错,跟踪到里边看,是因为CImageList中的m_hImageList为NULL,那么在Add中首先就是ASSERT(m_hImageList!=NULL),于是就出错了,那我该怎么用啊?