long tpWidth;
long tpHeight;
m_gpPicture->get_Width(&tpWidth);
m_gpPicture->get_Height(&tpHeight);
double pBL=((double)tpWidth)/((double)tpHeight);
RECT rc;
GetClientRect(&rc);
long vWidth=rc.right;
long vHeight=rc.bottom;
double vBL=((double)vWidth)/((double)vHeight);
long tvWidth;
long tvHeight;
if (pBL>vBL)
{
tvWidth=vWidth;
tvHeight=(long)((double)tvWidth/pBL);
}
else
{
tvHeight=vHeight;
tvWidth=(long)((double)tvHeight*pBL);
}
long trueWidth=(long)((double)tvWidth*m_ZoomScale);
long trueHeight=(long)((double)tvHeight*m_ZoomScale);
long trueX=(vWidth-trueWidth)/2-(long)((double)m_CenterPointX*m_ZoomScale);
long trueY=(vHeight-trueHeight)/2-(long)((double)m_CenterPointY*m_ZoomScale);