扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
CPoint point; int nWidth,nHeight; int dx,dy; int dx1,dy1; |
BOOL CFlashDlgDlg::OnInitDialog() { CDialog::OnInitDialog(); CRect dlgRect; GetWindowRect(dlgRect); CRect desktopRect; GetDesktopWindow()->GetWindowRect(desktopRect); MoveWindow( (desktopRect.Width() - dlgRect.Width()) / 2, (desktopRect.Height() - dlgRect.Height()) / 2, 0, 0 ); nWidth=dlgRect.Width(); nHeight=dlgRect.Height(); dx=2; dy=4; dx1=2; dy1=2; SetTimer(1,10 , NULL); return TRUE; } |
void CFlashDlgDlg::OnTimer(UINT nIDEvent) { // TODO: Add your message handler code here and/or call default CRect dlgRect; GetWindowRect(dlgRect); CRect desktopRect; GetDesktopWindow()->GetWindowRect(desktopRect); if(nIDEvent == 1) { MoveWindow( (-dx+desktopRect.Width() - dlgRect.Width()) / 2, (-dy+desktopRect.Height() - dlgRect.Height()) / 2, +dx+dlgRect.Width(), +dy+dlgRect.Height() ); if(dlgRect.Width() >=nWidth) dx=0; // do not over grow if(dlgRect.Height() >=nHeight) dy=0; // do not over grow if((dlgRect.Width() >=nWidth) && (dlgRect.Height() >=nHeight)) KillTimer(1); //Stop the timer } if((dlgRect.Width() >=nWidth) && (dlgRect.Height() >=nHeight)) KillTimer(1); //Stop the timer if(nIDEvent == 2) { MoveWindow((+dx+desktopRect.Width() - dlgRect.Width()) / 2, (+dy+desktopRect.Height() - dlgRect.Height()) / 2, -dx1+dlgRect.Width(), -dy1+dlgRect.Height() ); if(dlgRect.Width() <= 0) dx1=0; // do not over grow if(dlgRect.Height() <= 0 ) dy1=0; // do not over grow if((dlgRect.Width() <= 0 ) && (dlgRect.Height() <=0)) { KillTimer(2); //Stop the timer CDialog::OnOK(); } } CDialog::OnTimer(nIDEvent); } |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。