从CStatic派生重载OnPaint(),用IPicture接口,把picture画(Render)上去就ok!

解决方案 »

  1.   

    jazzrabbit:
    please tell me how to use IPicture
      

  2.   

    //全局变量
    LPPICTURE gpPicture;-------------
    CPicture fromthe;
    fromthe=this->m_picclip.GetGraphicCell(10);
    fromthe.m_lpDispatch->QueryInterface(IID_IPicture,(void **)&(gpPicture));-----------
    重载OnPaint():
    if(gpPicture)
    {
    CPaintDC dc(this); 
    long hmWidth;
    long hmHeight;
    gpPicture->get_Width(&hmWidth);
    gpPicture->get_Height(&hmHeight);
    // convert himetric to pixels
    int nWidth= MulDiv(hmWidth,GetDeviceCaps(dc.m_hDC, LOGPIXELSX), HIMETRIC_INCH);
    int nHeight= MulDiv(hmHeight, GetDeviceCaps(dc.m_hDC, LOGPIXELSY), HIMETRIC_INCH);
    RECT rc;
    this->GetClientRect(&rc);
    // display picture using IPicture::Render
    gpPicture->Render(dc.m_hDC, 0, 0, nWidth, nHeight, 0, hmHeight, hmWidth, -hmHeight, &rc);
    }