zoukankan      html  css  js  c++  java
  • 【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;
    }

    演示代码

  • 相关阅读:
    error_reporting(“E_ALL”)和ini_set(“display_errors”, “on”)的区别?
    linux命令awk的详解
    Ubuntu 能PING IP但不能PING主机域名的解决方法
    从github checkout子文件夹
    zuul简单使用
    docker for windows 10 添加阿里云镜像仓库无效问题
    Spring Boot 进行Bean Validate和Method Validate
    JVM调优-GC参数
    Spring Aop: 关于继承和execution target this @annotation
    ReentrantLock原理
  • 原文地址:https://www.cnblogs.com/ztercel/p/2173428.html
Copyright © 2011-2022 走看看