zoukankan      html  css  js  c++  java
  • C#.NET使用AnimateWindow制作淡入淡出特殊效果的窗体

    使用AnimateWindow制作淡入淡出效果的窗体
    
    命名空间:
    using System.Runtime.InteropServices;
    
    API函数:
    [DllImport("user32")]
    private static extern bool AnimateWindow(IntPtr whnd,int dwtime,int dwflag);
    //dwflag的取值如下
    public const Int32 AW_HOR_POSITIVE = 0x00000001;    
    //从左到右显示
    public const Int32 AW_HOR_NEGATIVE = 0x00000002;    
    //从右到左显示
    public const Int32 AW_VER_POSITIVE = 0x00000004;    
    //从上到下显示
    public const Int32 AW_VER_NEGATIVE = 0x00000008;    
    //从下到上显示
    public const Int32 AW_CENTER = 0x00000010;          
    //若使用了AW_HIDE标志,则使窗口向内重叠,即收缩窗口;否则使窗口向外扩展,即展开窗口
    public const Int32 AW_HIDE = 0x00010000;            
    //隐藏窗口,缺省则显示窗口
    public const Int32 AW_ACTIVATE = 0x00020000;        
    //激活窗口。在使用了AW_HIDE标志后不能使用这个标志
    public const Int32 AW_SLIDE = 0x00040000;           
    //使用滑动类型。缺省则为滚动动画类型。当使用AW_CENTER标志时,这个标志就被忽略
    public const Int32 AW_BLEND = 0x00080000;           
    //透明度从高到低
    
    //在Form_Load中添加代码实现窗体的淡入
    AnimateWindow(this.Handle, 3000, AW_BLEND | AW_ACTIVATE);
    //多个dwflag之间用 |   隔开
    //在Form_FormClosing中添加代码实现窗体的淡出
    AnimateWindow(this.Handle, 3000,AW_HOR_NEGATIVE | AW_HIDE);
    //必须有AW_HIDE才能看到窗体的淡出
  • 相关阅读:
    网页打开qq
    正则表达式
    微信小程序 如何使用globalData
    微信小程序中常见的typeof cb == “function” && cb(that.globalData.userInfo)
    MongoDB
    Elasticsearch学习
    Kafka学习之路 (一)Kafka的简介
    mybatis sql语句中转义字符
    定时任务
    mybatis insert into 返回id,useGeneratedKeys,keyColumn,keyProperty,parameterType
  • 原文地址:https://www.cnblogs.com/rinack/p/3798808.html
Copyright © 2011-2022 走看看