paip.c#.nett 系统托盘动态图标闪烁图标

paip.c#.nett 系统托盘动态图标闪烁图标




作者Attilax ,  EMAIL:1466519819@qq.com




思路:
抛个线程来定时切换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);





原文地址:https://www.cnblogs.com/attilax/p/15199680.html