C#动态系统托盘图标
利用timer组件定时执行变化。
1 using System; 2 using System.Windows.Forms; 3 4 namespace DynamicStockIcon 5 { 6 public partial class DynamicStockIcon : Form 7 { 8 public DynamicStockIcon() 9 { 10 InitializeComponent(); 11 } 12 13 private void DynamicStockIcon_Load(object sender, EventArgs e) 14 { 15 stocktimer.Interval = 400; 16 } 17 18 #region 本程序声明的变量 19 public static bool flag=false ; 20 #endregion 21 22 23 private void flicker_Click(object sender,EventArgs e) 24 { 25 stocktimer.Enabled = true; 26 27 } 28 29 private void cease_Click(object sender,EventArgs e) 30 { 31 stocktimer.Enabled = false; 32 stockIcon.Icon = Properties.Resources._1; 33 } 34 35 private void stocktimer_Tick(object sender,EventArgs e) 36 { 37 if(flag == false) 38 { 39 stockIcon.Icon = Properties.Resources._1; 40 flag = true; 41 } 42 else 43 { 44 stockIcon.Icon = Properties.Resources._2; 45 flag = false; 46 } 47 } 48 49 50 } 51 }
网名:浩秦; 邮箱:root#landv.pw; 只要我能控制一個國家的貨幣發行,我不在乎誰制定法律。金錢一旦作響,壞話隨之戛然而止。