C#版的仿造QQ图标闪烁

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

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/jingang123gz/archive/2007/10/26/1844270.aspx

posted @ 2009-08-17 21:41  oraclejava  阅读(785)  评论(0)    收藏  举报