由小变大动态弹出的对话框效果

BOOL CAboutDlg::OnInitDialog()
{
 CDialog::OnInitDialog();
 
 // TODO: Add extra initialization here
 //隐藏对话框
 ShowWindow(SW_HIDE);
 CRect dlgrect;   
 GetClientRect(&dlgrect);   //获得当前程序的区域
 CPoint centerPoint;
 centerPoint.x=dlgrect.Width()/2; 
 centerPoint.y=dlgrect.Height()/2;
 //得到对话框的中点坐标
 CRgn testrgn;
 this->ShowWindow(SW_HIDE);
 int m=GetSystemMetrics(SM_CYSIZEFRAME);  
 //得到边框宽度
    for(int i=10;i<dlgrect.Width()/2+2*m;i++)
 {

  testrgn.CreateRectRgn(centerPoint.x-i,centerPoint.y-i,centerPoint.x+i,centerPoint.y+i);//创建可视区域
        SetWindowRgn((HRGN)testrgn,true);  //设置可视区域 
  ShowWindow(SW_SHOW);
  CenterWindow();    //居中显示窗口
  testrgn.DeleteObject();   //释放区域资源
  Sleep(5);
 }
 return TRUE;  // return TRUE unless you set the focus to a control
               // EXCEPTION: OCX Property Pages should return FALSE
}

posted @ 2008-11-25 23:23  熊剑  阅读(439)  评论(0)    收藏  举报