7,540
社区成员
发帖
与我相关
我的任务
分享
[DllImport("user32")]
private static extern bool AnimateWindow(IntPtr hwnd,int dwtime,int nflag);
//nflag的取值如下
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; //透明度从高到低
CLOSE_OR_OPEN = AW_ACTIVATE; //打开
//CLOSE_OR_OPEN = AW_HIDE; //关闭
IntPtr hwnd = this.Handle;//窗口句柄
animatewindow(hwnd,200,AW_HOR_POSITIVE|CLOSE_OR_OPEN); //从左向右显示
animatewindow(hwnd,200,AW_HOR_NEGATIVE|CLOSE_OR_OPEN); //从右向左显示
animatewindow(hwnd,200,AW_VER_POSITIVE|CLOSE_OR_OPEN); //从上到下显示
animatewindow(hwnd,200,AW_VER_NEGATIVE|CLOSE_OR_OPEN); //从下到上显示
animatewindow(hwnd,200,AW_SLIDE|AW_HOR_POSITIVE|AW_VER_POSITIVE|CLOSE_OR_OPEN); //左上角伸展
animatewindow(hwnd,200,AW_SLIDE|AW_HOR_POSITIVE|AW_VER_POSITIVE|CLOSE_OR_OPEN); //左下角伸展
animatewindow(hwnd,200,AW_SLIDE|AW_HOR_NEGATIVE|AW_VER_NEGATIVE|CLOSE_OR_OPEN); //右上角伸展
animatewindow(hwnd,200,AW_SLIDE|AW_HOR_NEGATIVE|AW_VER_NEGATIVE|CLOSE_OR_OPEN); //右下角伸展