C#版的仿造QQ图标闪烁

发布时间:2009年06月04日      浏览次数:579 次
C#版的仿造QQ图标闪烁,其实就是一个动态图标以前做个一个
现在看到VB.NET做了一个我就把它改用C#来写

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections;
namespace 仿造QQ图标闪烁
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private Icon ico1 = new Icon("MOON01.ICO");
private Icon ico2 = new Icon("MOON02.ICO");
private Icon ico3 = new Icon("MOON03.ICO");
private Icon ico4 = new Icon("MOON04.ICO");
private Icon ico5 = new Icon("MOON05.ICO");
private Icon ico6 = new Icon("MOON06.ICO");
//private Icon ico7 = new Icon("MOON07.ICO");
//private Icon ico8 = new Icon("MOON08.ICO");
//用语存放以上的实例
private ArrayList ay = new ArrayList();
private int i = 0;
private void Form1_Load(object sender, EventArgs e)
{
//窗口起始状态
this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
//窗体完全透明,这个可要可不要。.
// this.Opacity = 0;
//不显示在任务栏
this.ShowInTaskbar = false;
//将所有ICO对象放进集合中
ay.Add(ico1);
ay.Add(ico2);
ay.Add(ico3);
ay.Add(ico4);
ay.Add(ico5);
ay.Add(ico6);
//ay.Add(ico7);
//ay.Add(ico8);
//timer时间间隔
this.timer1.Interval = 100;
this.notifyIcon1.Icon = ico1;

}
private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
{
}
//private void notifyIcon1_MouseUp(object sender, MouseEventArgs e)
//{
// //得到右健菜单
// contextMenu1.GetContextMenu();
//}
private void 开始ToolStripMenuItem_Click(object sender, EventArgs e)
{
//开始记时
this.timer1.Enabled = true;
}
private void 开始ToolStripMenuItem1_Click(object sender, EventArgs e)
{
//开始记时
this.timer1.Enabled = true;
}
private void timer1_Tick(object sender, EventArgs e)
{
//ICO转换控制。
if (i < 5)
{
notifyIcon1.Icon = (Icon)ay[i];
i++;
return;
}
else
notifyIcon1.Icon = (Icon)ay[0];
i = 1;
}
private void 停止ToolStripMenuItem_Click(object sender, EventArgs e)
{
//停止记时
this.timer1.Enabled = false;
}
private void 停止ToolStripMenuItem1_Click(object sender, EventArgs e)
{
//停止记时
this.timer1.Enabled = false;
}
private void 退出ToolStripMenuItem1_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
}

本例源码下载:http://dl2.csdn.net/down4/20071026/26085211757.rar
免责声明:本站相关技术文章信息部分来自网络,目的主要是传播更多信息,如果您认为本站的某些信息侵犯了您的版权,请与我们联系,我们会即时妥善的处理,谢谢合作!