窗体的动画效果

博客展示了AnimateWindow函数的使用,通过DllImport引入user32库,定义了多种动画效果的常量,如水平、垂直移动及淡入淡出等,还给出了在Form1关闭时调用该函数实现特定动画效果的代码示例。

  [System.Runtime.InteropServices.DllImport("user32")]
  private static extern bool AnimateWindow(IntPtr hwnd,int dwTime, int dwFlags);
  const int AW_HOR_POSITIVE = 0x0001;
  const int AW_HOR_NEGATIVE = 0x0002;
  const int AW_VER_POSITIVE = 0x0004;
  const int AW_VER_NEGATIVE = 0x0008;
  const int AW_CENTER = 0x0010;
  const int AW_HIDE = 0x10000;
  const int AW_ACTIVATE = 0x20000;
  const int AW_SLIDE = 0x40000;
  const int AW_BLEND = 0x80000;  

private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
  {
          AnimateWindow(this.Handle, 1000, AW_SLIDE | AW_HIDE | AW_VER_NEGATIVE);
  }

Syntax

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

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. Note that, by default, these flags take effect when showing a window. To take effect when hiding a window, use AW_HIDE and a logical OR operator with the appropriate flags.
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.
基于部落竞争与成员合作算法(CTCM)融合动态窗口法DWA的无人机三维动态避障方法研究,MATLAB代码 动态避障路径规划:基于部落竞争与成员合作算法(CTCM)融合动态窗口法DWA的无人机三维动态避障方法研究,MATLAB 融合DWA的青蒿素优化算法(AOA)求解无人机三维动态避障路径规划,MATLAB代码 基于动态环境下多智能体自主避障路径优化的DWA算法研究,MATLAB代码 融合DWA的青蒿素优化算法AOA求解无人机三维动态避障路径规划,MATLAB代码 基于DWA的多智能体动态避障路径规划算法研究,MATLAB代码 融合动态窗口法DWA的粒子群算法PSO求解无人机三维动态避障路径规划研究,MATLAB代码 基于粒子群算法PSO融合动态窗口法DWA的无人机三维动态避障路径规划研究,MATLAB代码 基于ACOSRAR-DWA无人机三维动态避障路径规划,MATLAB代码 基于ACOSRAR-DWA无人机三维动态避障路径规划,MATLAB代码 基于DWA的动态环境下无人机自主避障路径优化,MATLAB代码 基于DWA的动态环境下机器人自主避障路径规划,MATLAB代码 基于城市场景下RRT、ACO、A*算法的无人机三维路径规划方法研究,MATLAB代码 基于城市场景下无人机三维路径规划的导航变量的多目标粒子群优化算法(NMOPSO),MATLAB代码 导航变量的多目标粒子群优化算法(NMOPSO)求解复杂城市场景下无人机三维路径规划,MATLAB代码 原创:5种最新多目标优化算法求解多无人机协同路径规划(多起点多终点,起始点、无人机数、障碍物可自定义),MATLAB代码 原创:4种最新多目标优化算法求解多无人机协同路径规划(多起点多终点,起始点、无人机数、障碍物可自定义),MATLAB代码 高维超多目标优化:基于导航变量的多目标粒子群优化算法(NMOPSO)的无人机三维
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值