1、導入動態庫方法:
[System.Runtime.InteropServices.DllImport("USER32.DLL")]
public static extern int FlashWindow(int hwnd, int iStart);
//hwnd : 控件的句柄實例值
//iStart : 參數爲1時啓動閃爍, 參數爲0時停止閃爍
2、使用動態庫函數:FlashWindow(this.Handle.ToInt32(), 1); // 參數爲1時啓動閃爍, 參數爲0時停止閃爍
//this : 表示Form窗口
3、定時器進行閃動(在窗口加載事件中添加如下內容):
Timer timer = new Timer();
timer.Interval = 200;
timer.Enabled = true;
timer.Tick += delegate {
FlashWindow(this.Handle.ToInt32(), 1);
};