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 );
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{
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);
}
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
);
m_sizeDest=m_sizeDest*2 表示放大2倍
m_zhongNew=point 表示我用鼠标点击的点的位置m_zhongNew-rectClient*2\2 用点的坐标来减去客hu区坐标,得到新的中心点和原来中心点的距离差,先*2是先放大2倍,/2s是表示去的客hu区的中心坐标
mZuoshang=mZuoshang/2-m_zhong; 用原来的左上方坐标减去距离差,应该就是新的坐标(左上方)的位置了吧,
请指教~~~~~~~~~~~~~~~~