paip.c#.nett 系統托盤動態圖標閃爍圖標
思路:
拋個線程來定時切換notifyIcon1.Icon。類似QQ的閃爍時間在400MS左右。。
代碼如下
NotifyIcon notifyIcon1 = new NotifyIcon();
notifyIcon1.Icon= new System.Drawing.Icon(pathC23.appPathDisk()+"\\APTN.ico");
notifyIcon1.Icon = new System.Drawing.Icon(pathC23.appPathDisk() + "\\APk.ico");
//設置鼠標放在托盤圖標上面的文字
notifyIcon1.Text = "心語托盤圖標";
notifyIcon1.Visible = true;
//c452308 add txt2list
Thread t = new Thread(new ParameterizedThreadStart(
delegate(object obj)
{
Icon icon1 = new System.Drawing.Icon(pathC23.appPathDisk() + "\\APTN.ico");
Icon icon2=new System.Drawing.Icon(pathC23.appPathDisk() + "\\APk.ico");
while (1==1)
{
Thread.Sleep(400);
if (notifyIcon1.Icon == (icon1))
notifyIcon1.Icon = icon2;
else
notifyIcon1.Icon = icon1;
}
}));
t.Name = " --start tray thread";
t.IsBackground = true;
t.Priority = ThreadPriority.Lowest;
t.Start(null);