直接codes:
int CAnimateWindowDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
RECT rect;
CClientDC dc(this);
int width = dc.GetDeviceCaps(HORZRES);
int height = dc.GetDeviceCaps(VERTRES);
GetWindowRect( &rect );
width = ( width - ( rect.right - rect.left ))/2 ;
height = (height - (rect.bottom - rect.top ))/2 ;
MoveWindow( width , height , (rect.right - rect.left ) , (rect.bottom - rect.top ) ,true);
//AnimateWindow(GetSafeHwnd(), 1000, AW_BLEND|AW_CENTER); //淡入
AnimateWindow(1000, AW_BLEND|AW_CENTER); //淡入
return 0;
}
void CAnimateWindowDlg::OnClose()
{
// TODO: Add your message handler code here and/or call default
//AnimateWindow(GetSafeHwnd(), 1000, AW_HIDE|AW_CENTER); //淡出
AnimateWindow( 1000, AW_HIDE|AW_CENTER); //淡出
CDialog::OnClose();
}