引用 using System.Runtime.InteropServices;
下面为方法 ,直接 拷贝 使用
[DllImport("user32.dll")]
private static extern bool AnimateWindow(IntPtr hwnd, int dwtime, int dwflags);
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;
public const Int32 AW_HIDE = 0X00010000;
public const Int32 AW_ACTIVATE = 0X00020000;
public const Int32 AW_SLIDE = 0X00040000;
public const Int32 AW_BLEND = 0X00080000;
public Form1()
{
InitializeComponent();
AnimateWindow(this.Handle, 300, AW_SLIDE + AW_VER_NEGATIVE);
}
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
AnimateWindow(this.Handle, 300, AW_SLIDE + AW_VER_NEGATIVE + AW_HIDE);
}
---缓动打开页面 和关闭页面
-闪动窗体
[DllImport("user32.dll")]
private static extern bool FlashWindow(IntPtr handle, bool bInvert);
FlashWindow(this.Handle, true);