程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> .NET網頁編程 >> C# >> C#入門知識 >> paip.c#.nett 系統托盤動態圖標閃爍圖標

paip.c#.nett 系統托盤動態圖標閃爍圖標

編輯:C#入門知識

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);

 

 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved