请部如何使用ActiveX控件的kodak图像缩略图控制控件来做一个简单的ACDSee程序?
建立一个Windows Explorer的工程,要左边是CListView,右边是CView,在CView
中如何画出N个缩略图并使它自动适应图片大小?

解决方案 »

  1.   

    CLeftView要在CScrollView上派生。左缩略图一、建立一个Object Array,每读出一个图像建立一个CImgEdit的实例。
    for(n=iStart;n<=iEnd;n++)
    {
    CImgEdit * pImg=new CImgEdit;
    m_arrayImg.Add(pImg);
    pImg->Create(NULL,0,CRect(0,0,0,0),this,33761+n);
    pImg->SetImage(szImg.GetBuffer(0));//文件名
    }二、在左缩略图上显示图像
    int x=20,y=20;//起始位置
    CRect sz,ss;
    GetClientRect(sz);
    long lMax=0,lMaxX=0,lMaxY=0;
    for(int m=0;m<n;m++)
    {
    long lWidth=m_arrayImg.GetAt(m)->GetImageWidth();
    long lHeight=m_arrayImg.GetAt(m)->GetImageHeight();
    if(lWidth>lHeight){lHeight=(long)(m_dwImgSize*((float)lHeight/lWidth));lWidth=m_dwImgSize;}
    else{lWidth=(long)(m_dwImgSize*((float)lWidth/lHeight));lHeight=m_dwImgSize;}
    lMax=lHeight>lMax?lHeight:lMax;
    if(x+lWidth>sz.Width())
    {
    x=20;
    y+=lMax;
    y+=30;
    lMax=0;
    }
    ss.CopyRect(CRect(x,y,x+lWidth,y+lHeight));
    x+=lWidth;
    x+=30;
    lMaxX=x>lMaxX?x:lMaxX;
    lMaxY=y+lHeight+30>lMaxY?y+lHeight+30:lMaxY;
    m_arrayImg.GetAt(m)->MoveWindow(ss);
    COleVariant var;
    var.boolVal=true;
    var.ChangeType(VT_BOOL);
    m_arrayImg.GetAt(m)->FitTo(0,var);
    m_arrayImg.GetAt(m)->Display();
    m_arrayImg.GetAt(m)->ShowWindow(SW_SHOW);
    }
    Invalidate();右视图再建立一个CImgEdit,左边点哪个右边就显示哪个好了。