摘要:讓程式縮小在工具列時會閃爍
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
[DllImport("user32.dll")]
private static extern bool FlashWindowEx(ref FLASHWINFO fi);
private struct FLASHWINFO
{
public uint cbSize;
public IntPtr hwnd;
public uint dwFlags;
public uint uCount;
public uint dwTimeout;
}
const uint FLASHW_ALL = 3;
const uint FLASHW_TIMERNOFG = 12;
public Form1()
{
InitializeComponent();
}
private void Form1_Deactivate(object sender, EventArgs e)
{
if (WindowState == FormWindowState.Minimized)
{
FLASHWINFO FlashWINInfo = new FLASHWINFO();
FlashWINInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(FlashWINInfo));
FlashWINInfo.hwnd = Handle;
FlashWINInfo.dwFlags = FLASHW_ALL | FLASHW_TIMERNOFG;
FlashWINInfo.uCount = uint.MaxValue;
FlashWINInfo.dwTimeout = 0;
FlashWindowEx(ref FlashWINInfo);
}
}
}
}