动画启动程序

发布时间:2016-12-6 8:56:38 编辑:www.fx114.net 分享查询网我要评论
本篇文章主要介绍了"动画启动程序",主要涉及到动画启动程序方面的内容,对于动画启动程序感兴趣的同学可以参考一下。

下面实现的功能属于窗口特效,不知道你有没有发现,像金山卫士等软件,都有一个比较花哨的启动画面,下面我们利用MFC内置的函数实现这一功能,请相信,这真的很简单。   先来看看MSDN里的介绍: AnimateWindow The AnimateWindow function enables you to produce special effects when showing or hiding windows. There are three types of animation: roll, slide, and alpha-blended fade. BOOL AnimateWindow(   HWND hwnd,     // handle to window   DWORD dwTime,  // duration of animation   DWORD dwFlags  // animation type ); Parameters hwnd [in] Handle to the window to animate. The calling thread must own this window. dwTime [in] Specifies how long it takes to play the animation, in milliseconds. Typically, an animation takes 200 milliseconds to play. dwFlags [in] Specifies the type of animation. This parameter can be one or more of the following values. Value Description AW_SLIDE Uses slide animation. By default, roll animation is used. This flag is ignored when used with AW_CENTER. AW_ACTIVATE Activates the window. Do not use this value with AW_HIDE. AW_BLEND Uses a fade effect. This flag can be used only if hwnd is a top-level window. AW_HIDE Hides the window. By default, the window is shown. AW_CENTER Makes the window appear to collapse inward if AW_HIDE is used or expand outward if the AW_HIDE is not used. AW_HOR_POSITIVE Animates the window from left to right. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND. AW_HOR_NEGATIVE Animates the window from right to left. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND. AW_VER_POSITIVE Animates the window from top to bottom. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND. AW_VER_NEGATIVE Animates the window from bottom to top. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND.   AnimateWindow,利用这个函数可以实现动画启动程序,参数分别指的是动画窗口的句柄,动画启动后持续的时间,标志位,当然,这个函数时sdk里的api,MFC也封装了一个函数,原型就是: AnimateWindow( DWORD dwTime,  // duration of animation   DWORD dwFlags  // animation type )   这个函数是在afxwin4.inl里定义的,如下所示: AFX_INLINE BOOL CWnd::AnimateWindow(DWORDdwTime,DWORDdwFlags) {        ASSERT(::IsWindow(m_hWnd));        return ::AnimateWindow(m_hWnd,dwTime,dwFlags); }   利用上面的标志位,我们可以实现窗口暗淡显示(AW_BLEND ),窗口有中间向外扩展(AW_CENTER) 窗口由上向下拉伸(AW_VER_POSITIVE),窗口由下到上拉伸(AW_VER_NEGATIVE)等。   下面就简单实现:   在单文档程序里的框架窗口的类的OnCreate 消息里添加: CenterWindow();        AnimateWindow(800,AW_CENTER);//     然后我们要实现在窗口关闭时也有动画效果: 在主框架类添加消息:WM_CLOSE void CMainFrame::OnClose() {                 AnimateWindow(800,AW_CENTER|AW_HIDE);//                          CFrameWndEx::OnClose(); } 运行一下看看,的确不错。

上一篇:修改窗口的图标 修改视窗光标
下一篇:【索引】Hashing / Sets

相关文章

关键词: 动画启动程序

相关评论