MFC窗口特效之动画效果
标签:
•
文件类型: .rar
•
文件大小: 4.94MB
•
下载次数: 1
•
MFC窗口特效之动画效果,可以应用在一个对话框或者其派生类上,实现动画打开和动画关闭效果
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3104 2010-04-02 15:18 FileHandlerCDlgFlash.cpp
文件 1763 2010-04-01 15:17 FileHandlerCDlgFlash.h
文件 37620 2010-04-02 15:17 FileHandlercopyfile.aps
文件 1858 2010-04-02 15:48 FileHandlercopyfile.clw
文件 2196 2010-03-30 12:30 FileHandlercopyfile.cpp
文件 4326 2010-03-31 13:46 FileHandlercopyfile.dsp
文件 541 2010-03-28 18:03 FileHandlercopyfile.dsw
文件 1346 2010-03-28 18:03 FileHandlercopyfile.h
文件 99328 2010-04-02 15:48 FileHandlercopyfile.ncb
文件 55808 2010-04-02 15:48 FileHandlercopyfile.opt
文件 1648 2010-04-02 15:48 FileHandlercopyfile.plg
文件 5876 2010-04-02 15:17 FileHandlercopyfile.rc
文件 10591 2010-04-02 15:48 FileHandlercopyfileDlg.cpp
文件 1952 2010-04-02 15:13 FileHandlercopyfileDlg.h
文件 9707 2010-04-02 15:18 FileHandlerDebugCDlgFlash.obj
文件 0 2010-04-02 15:18 FileHandlerDebugCDlgFlash.sbr
文件 3654656 2010-04-02 15:18 FileHandlerDebugcopyfile.bsc
文件 118876 2010-04-02 15:18 FileHandlerDebugcopyfile.exe
文件 296664 2010-04-02 15:18 FileHandlerDebugcopyfile.ilk
文件 14986 2010-04-02 15:13 FileHandlerDebugcopyfile.obj
文件 6880400 2010-04-01 14:44 FileHandlerDebugcopyfile.pch
文件 427008 2010-04-02 15:18 FileHandlerDebugcopyfile.pdb
文件 4072 2010-04-02 15:17 FileHandlerDebugcopyfile.res
文件 0 2010-04-02 15:13 FileHandlerDebugcopyfile.sbr
文件 54828 2010-04-02 15:16 FileHandlerDebugcopyfileDlg.obj
文件 0 2010-04-02 15:16 FileHandlerDebugcopyfileDlg.sbr
文件 105770 2010-04-01 14:44 FileHandlerDebugStdAfx.obj
文件 1369712 2010-04-01 14:44 FileHandlerDebugStdAfx.sbr
文件 205824 2010-04-02 15:18 FileHandlerDebugvc60.idb
文件 372736 2010-04-02 15:18 FileHandlerDebugvc60.pdb
............此处省略21个文件信息
// DlgFlash.cpp: implementation of the CDlgFlash class.
//
//////////////////////////////////////////////////////////////////////
#include “stdafx.h“
#include “CDlgFlash.h“
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CDlgFlash::CDlgFlash(CDialog* Dlg)
{
flashDlg=Dlg;
Timer1_ID=9;
Timer2_ID=10;
InitCDlg();
}
CDlgFlash::CDlgFlash(CDialog* Dlgint Timer1_IDint Timer2_ID)
{
flashDlg=Dlg;
this->Timer1_ID=Timer1_ID;
this->Timer2_ID=Timer2_ID;
InitCDlg();
}
CDlgFlash::~CDlgFlash()
{
}
void CDlgFlash::InitCDlg(){
//获得窗口预设的大小
CRect dlgRect;
flashDlg->GetWindowRect(dlgRect);
//获取屏幕大小
CRect desktopRect;
flashDlg->GetDesktopWindow()->GetWindowRect(desktopRect);
//将窗口开始大小设为0,居中
flashDlg->MoveWindow(dlgRect.left + dlgRect.Width() / 2
dlgRect.top + dlgRect.Height() / 2
0
0
);
//数据成员初始化
OriginalWidth=dlgRect.Width();
OriginalHeight=dlgRect.Height();
xCreateSpeed=2;
yCreateSpeed=3;
xDestorySpeed=2;
yDestorySpeed=3;
//设定定时器Timer1_ID
flashDlg->SetTimer(Timer1_ID10NULL);
}
void CDlgFlash::OnTimer(UINT nIDEvent){
{
//获得此时窗口的实际大小
CRect dlgRect;
flashDlg->GetWindowRect(&dlgRect);
//获得桌面的大小
CRect desktopRect;
flashDlg->GetDesktopWindow()->GetWindowRect(desktopRect);
//如果是窗口弹出过程,窗口居中,逐渐增大窗口
if(nIDEvent ==Timer1_ID)
{
flashDlg->MoveWindow(
(desktopRect.Width() - dlgRect.Width()) / 2
(desktopRect.Height() - dlgRect.Height()) / 2
xCreateSpeed+dlgRect.Width()
yCreateSpeed+dlgRect.Height()
);
//不要超过窗口预设的宽度
if(dlgRect.Width() >=OriginalWidth)
xCreateSpeed=0;
//不要超过窗口预设的高度
if(dlgRect.Height() >=OriginalHeight)
yCreateSpeed=0;
//停止变化,关闭定时器Timer1_ID
if((dlgRect.Width() >=OriginalWidth) && (dlgRect.Height() >=OriginalHeight))
flashDlg->KillTimer(Timer1_ID);
}
//如果是窗口关闭过程,则逐渐缩小窗口
if(nIDEvent == Timer2_ID)
{
flashDlg->MoveWindow(DestoryPosX
DestoryPosY
dlgRect.Width()
dlgRect.Height()-yDestorySpeed
);
//当高度等于零后高度就不在变化
//if(dlgRect.Height() <=0)
//停止变化,关闭定时器Timer2_ID,并且关闭窗口
if(dlgRect.Height() <=0)
{
yDestorySpeed=0;
flashDlg->KillTimer(Timer1_ID);
flashDlg->DestroyWindow();
}
}
}
}
void CDlgFlash::StartFlashDestroyDlg(){
CRect dlgRect;
//获取窗口当前的位置并保存
flashDlg->GetWindowRect(&dlgRect);
DestoryPosX=dlgRect.left;
DestoryPosY=dlgRect.top;
//开始启动定时器Timer2_ID
flashDlg->SetTimer(Timer2_ID10NULL);
}
void CDlgFlash::SetFlashCreateSpeed(int xint y){
xCreateSpeed=x;
xCreateSpeed=y;
}
void CDlgFlash::SetFlashDestroySpeed(int y){
yDestorySpeed=y;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3104 2010-04-02 15:18 FileHandlerCDlgFlash.cpp
文件 1763 2010-04-01 15:17 FileHandlerCDlgFlash.h
文件 37620 2010-04-02 15:17 FileHandlercopyfile.aps
文件 1858 2010-04-02 15:48 FileHandlercopyfile.clw
文件 2196 2010-03-30 12:30 FileHandlercopyfile.cpp
文件 4326 2010-03-31 13:46 FileHandlercopyfile.dsp
文件 541 2010-03-28 18:03 FileHandlercopyfile.dsw
文件 1346 2010-03-28 18:03 FileHandlercopyfile.h
文件 99328 2010-04-02 15:48 FileHandlercopyfile.ncb
文件 55808 2010-04-02 15:48 FileHandlercopyfile.opt
文件 1648 2010-04-02 15:48 FileHandlercopyfile.plg
文件 5876 2010-04-02 15:17 FileHandlercopyfile.rc
文件 10591 2010-04-02 15:48 FileHandlercopyfileDlg.cpp
文件 1952 2010-04-02 15:13 FileHandlercopyfileDlg.h
文件 9707 2010-04-02 15:18 FileHandlerDebugCDlgFlash.obj
文件 0 2010-04-02 15:18 FileHandlerDebugCDlgFlash.sbr
文件 3654656 2010-04-02 15:18 FileHandlerDebugcopyfile.bsc
文件 118876 2010-04-02 15:18 FileHandlerDebugcopyfile.exe
文件 296664 2010-04-02 15:18 FileHandlerDebugcopyfile.ilk
文件 14986 2010-04-02 15:13 FileHandlerDebugcopyfile.obj
文件 6880400 2010-04-01 14:44 FileHandlerDebugcopyfile.pch
文件 427008 2010-04-02 15:18 FileHandlerDebugcopyfile.pdb
文件 4072 2010-04-02 15:17 FileHandlerDebugcopyfile.res
文件 0 2010-04-02 15:13 FileHandlerDebugcopyfile.sbr
文件 54828 2010-04-02 15:16 FileHandlerDebugcopyfileDlg.obj
文件 0 2010-04-02 15:16 FileHandlerDebugcopyfileDlg.sbr
文件 105770 2010-04-01 14:44 FileHandlerDebugStdAfx.obj
文件 1369712 2010-04-01 14:44 FileHandlerDebugStdAfx.sbr
文件 205824 2010-04-02 15:18 FileHandlerDebugvc60.idb
文件 372736 2010-04-02 15:18 FileHandlerDebugvc60.pdb
............此处省略21个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)