Reputation: 542
I'm trying to archive the blinking effect as shown in the image with my C# main form. I've Googled a lot and I've seen that it is possible with System.Windows.Shell
and TaskbarItemInfo
. This seems much more easy than downloading and importing those dlls
.
I know how to make a new TaskbarItemInfo
, but I don't know how I can connect it to the main form.
Any suggestions how I can do this with the System.Windows.Shell
reference?
Upvotes: 3
Views: 3588
Reputation: 191
Cant See the image..are you talking about the windows 7 blinking effect
To make a new TaskbarItemInfo:
public TaskbarItemInfo TaskbarItemInfo { get; set; }
public Form1()
{
InitializeComponent();
this.TaskbarItemInfo = new TaskbarItemInfo();//
}
But I prefer this:
using System.Runtime.InteropServices;
[DllImport("user32.dll")]
public static extern int FlashWindow(IntPtr Hwnd, bool Revert);
// check if window is minimised
private void Form4_Resize(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
FlashWindow(this.Handle, false);
}
This should work..
Also // Flash window until it recieves focus FlashWindow.Flash(this);
// Flash window 5 times FlashWindow.Flash(this, 5);
// Start Flashing "Indefinately" FlashWindow.Start(this);
// Stop the "Indefinate" Flashing FlashWindow.Stop(this);
Upvotes: 1