| ²é¿´: 137 | »Ø¸´: 0 | |||
| µ±Ç°Ö÷ÌâÒѾ´æµµ¡£ | |||
zsgllyľ³æ (ÖøÃûдÊÖ)
|
[½»Á÷]
ÈçºÎµÈ±ÈÀýËõ·ÅͼÏñ
|
||
|
ÔÚ·Å´ó»òËõСͼÏñʱ£¬ÈçºÎÄÜ×îºÃµÄ±£³ÖͼÏñÔ̬±ÈÀýÀ´ÏÔÊ¾ÄØ£¿ÏÂÃæÌṩһ¸öºÊý¿É°ïÄãÀ´ÊµÏÖ£¬µ÷ÓÃËüºó£¬·µ»ØµÄ¾ØÐÎÇøÓò¼ÈΪ×î¼ÑÏÔʾͼÏñ´óС¡£ l ºÊýÖеĵÚÒ»¸ö²ÎÊýrcScreenΪͼÏñÒª±»ÏÔʾµÄ¾ØÐδóС£¬µÚ¶þ¸ö²ÎÊýsizePictureΪͼÏñ×ÔÉí´óС£¬µÚÈý¸ö²ÎÊýbCenterΪÊÇ·ñ¾ÓÖÐÏÔʾ£¬·µ»ØÖµCRect¼ÈΪͼÏñ×î¼ÑÏÔʾ´óС¡£ ºÊýÈçÏÂËùʾ£º CRect RectSizeWithConstantRatio( CRect* rcScreen, CSize sizePicture, BOOL bCenter) { CRect rect(rcScreen); double dWidth = rcScreen->Width(); double dHeight = rcScreen->Height(); double dAspectRatio = dWidth/dHeight; double dPictureWidth = sizePicture.cx; double dPictureHeight = sizePicture.cy; double dPictureAspectRatio = dPictureWidth/dPictureHeight; //If the aspect ratios are the same then the screen rectangle // will do, otherwise we need to calculate the new rectangle if (dPictureAspectRatio > dAspectRatio) { int nNewHeight = (int)(dWidth/dPictureWidth*dPictureHeight); int nCenteringFactor = (rcScreen->Height() - nNewHeight) / 2; rect.SetRect( 0, nCenteringFactor, (int)dWidth, nNewHeight + nCenteringFactor); } else if (dPictureAspectRatio < dAspectRatio) { int nNewWidth = (int)(dHeight/dPictureHeight*dPictureWidth); int nCenteringFactor = (rcScreen->Width() - nNewWidth) / 2; rect.SetRect( nCenteringFactor, 0, nNewWidth + nCenteringFactor, (int)(dHeight)); } return rect; }; [ Last edited by »ÃÓ°ÎÞºÛ on 2006-11-17 at 08:19 ] |
» ²ÂÄãϲ»¶
340Çóµ÷¼Á
ÒѾÓÐ3È˻ظ´
²ÄÁÏר˶ÕÒµ÷¼Á
ÒѾÓÐ4È˻ظ´
0854µç×ÓÐÅÏ¢Çóµ÷¼Á
ÒѾÓÐ6È˻ظ´
0805 316Çóµ÷¼Á
ÒѾÓÐ4È˻ظ´
0854 ¿¼Ñе÷¼Á ÕÐÉúÁË£¡AI ·½Ïò
ÒѾÓÐ17È˻ظ´
¡¾¿¼Ñе÷¼Á¡¿»¯Ñ§×¨Òµ 281·Ö£¬Ò»Ö¾Ô¸ËÄ´¨´óѧ£¬³ÏÐÄÇóµ÷¼Á
ÒѾÓÐ15È˻ظ´
×ÊÔ´Óë»·¾³ µ÷¼ÁÉêÇë(333·Ö)
ÒѾÓÐ7È˻ظ´
306Çó0703µ÷¼ÁÒ»Ö¾Ô¸»ªÖÐʦ·¶
ÒѾÓÐ11È˻ظ´
0703»¯Ñ§µ÷¼Á£¬Çóµ¼Ê¦ÊÕ
ÒѾÓÐ6È˻ظ´
Çóµ÷¼Á
ÒѾÓÐ5È˻ظ´














»Ø¸´´ËÂ¥