• 【Demo 0049】动画窗体


    动画窗体主要指的是创建或显示时以及隐藏窗体陪随的动画显示或隐藏效果; Window 提供了一个叫AnimateWindow这样的API, 这个效果就是使用这个函数实现的.

    1.  函数声明

         BOOL AnimateWindow(HWND hwnd, DWORD dwTime, DWORD dwFlags);

         hWnd:         需动画效果的窗体句柄(此窗体要同属于动画效果线程的)

         dwTime:      动画的时间周期

         dwFlags:     动画效果类型

             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. The various direction flags have no effect.
       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.

    2.  代码演示

         1. 创建一个隐藏的窗体;

         2. 调用_DemoAnimateWnd函数,演示各种动画类型效果,演示过程: 动画显示并维持1秒后动画隐藏,不同类型效果切换间隔2秒


    void _DemoAnimateWnd(HWND hWnd)
    {
        UINT dwEffType[] = { AW_BLEND, AW_CENTER, AW_HOR_POSITIVE,
                             AW_HOR_NEGATIVE, AW_VER_POSITIVE, AW_VER_NEGATIVE };
        assert(NULL != hWnd && IsWindow(hWnd));
        for (int nIndex = 0; nIndex < (sizeof(dwEffType) / sizeof(*dwEffType)); nIndex++)
        {
            AnimateWindow(hWnd, 300, dwEffType[nIndex]);
            Sleep(1000);
            AnimateWindow(hWnd, 300, dwEffType[nIndex]|AW_HIDE);

            Sleep(2000);
        }

        return;
    }

    演示代码

  • 相关阅读:
    node.js代码
    弹性盒和多列布局
    浏览器兼容性
    图片整合与宽高自适应
    百度分享自定义设置
    设置Cookie,登录记住用户登录信息,获取用户登录过得信息
    验证用户是否登录,是否有过注册信息
    循环显示切换
    ajax提交表单 验证
    简单易用的点击展开伸缩效果
  • 原文地址:https://www.cnblogs.com/ztercel/p/2173428.html
Copyright © 2020-2023  润新知