to  kimryo(轻*轻*前*轻*重) 
   stretchblt 具体怎么用,????

解决方案 »

  1.   

    我看了stretchblt,他的用法我也知道,我的意思是,我用鼠标点击一个地方,然后图片自动放大一个固定的比例,并且鼠标点击处为放大后的图形屏幕的中心!!
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      

  2.   

    那就要做一系列的工作: 取得鼠标的位置,设置stretchblt的位图显示位置。你的比例算法,再设置具体位图大小。
      

  3.   

    void CMapView::OnLButtonDown(UINT nFlags, CPoint point) 
    {
    CRect rectClient;
    GetClientRect(&rectClient);
             m_sizeDest.cx=m_sizeDest.cx*2;//2为放大的倍数
    m_sizeDest.cy=m_sizeDest.cy*2;
    m_zhongNew.x=point.x;
    m_zhongNew.y=point.y;//在图片上点击的位置,也是放大后的中心
    m_zhong.x=m_zhongNew.x-rectClient.right;
    m_zhong.y=m_zhongNew.y-rectClient.bottom;
    mZuoshang.x=mZuoshang.x/2-m_zhong.x;
             mZuoshang.y=mZuoshang.y/2-m_zhong.y;
    }
    void CMapView::OnDraw(CDC* pDC)
    {

    CMapDoc* pDoc = GetDocument();
    ASSERT_VALID(pDoc); pDC->SetStretchBltMode(COLORONCOLOR);


    pDC->StretchBlt(mZuoshang.x,mZuoshang.y,m_sizeDest.cx,m_sizeDest.cy,
    m_pdcMemory,0,0,
    m_sizeSource.cx,m_sizeSource.cy,SRCCOPY);

    }
      

  4.   

    StretchBlt(mZuoshang.x,mZuoshang.y/*这里不对,你不是说图片中心显示在鼠标位置吗*/,m_sizeDest.cx,m_sizeDest.cy,
          m_pdcMemory,0,0,
          m_sizeSource.cx,m_sizeSource.cy,SRCCOPY);
    BOOL StretchBlt(    HDC hdcDest, // handle of destination device context 
        int nXOriginDest, // x-coordinate of upper-left corner of dest. rect. 
        int nYOriginDest, // y-coordinate of upper-left corner of dest. rect. 
        int nWidthDest, // width of destination rectangle 
        int nHeightDest, // height of destination rectangle 
        HDC hdcSrc, // handle of source device context 
        int nXOriginSrc, // x-coordinate of upper-left corner of source rectangle 
        int nYOriginSrc, // y-coordinate of upper-left corner of source rectangle 
        int nWidthSrc, // width of source rectangle 
        int nHeightSrc, // height of source rectangle 
        DWORD dwRop  // raster operation code 
       );
      

  5.   

    mZuoshang.x,mZuoshang.y是代表的显示图片的左上角的坐标吧,
    m_sizeDest=m_sizeDest*2 表示放大2倍
    m_zhongNew=point 表示我用鼠标点击的点的位置m_zhongNew-rectClient*2\2 用点的坐标来减去客hu区坐标,得到新的中心点和原来中心点的距离差,先*2是先放大2倍,/2s是表示去的客hu区的中心坐标
    mZuoshang=mZuoshang/2-m_zhong; 用原来的左上方坐标减去距离差,应该就是新的坐标(左上方)的位置了吧,
    请指教~~~~~~~~~~~~~~~~