110,567
社区成员
发帖
与我相关
我的任务
分享
private System.Windows.Forms.Timer timer1;
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
this.timer1.Enabled = true;
private Icon GetIcon(int no)
{
Icon ico = null;
if (no < 4)
{
Image img = imageList1.Images[no];
Bitmap bmp = new Bitmap(img);
ico = Icon.FromHandle(bmp.GetHicon());
}
else
MessageBox.Show("超出ImageList图片的索引!");
return ico;
}
//变色
int i = 1;
private void timer3_Tick(object sender, EventArgs e)
{
if (i == 1)
{
this.notifyIcon1.Icon = GetIcon(i);
i--;
}
else
{
this.notifyIcon1.Icon = GetIcon(i);
i++;
}
}
string hour = System.DateTimeOffset.Now.Hour.ToString();
string minute = System.DateTimeOffset.Now.Minute.ToString();
string second = System.DateTimeOffset.Now.Second.ToString();
lblTime.Text = "现在时间:"+hour +":"+minute+":"+second;