好象有个notification类,还有他自己有个控件,你可以拖到form就可以

解决方案 »

  1.   


    添加  NotifyIcon,设定你在托盘的图标 把form  的 showintoolbar  设为 false
     
    private void ntIcon_DoubleClick(object sender, System.EventArgs e) { if (this.WindowState == FormWindowState.Minimized) { this.Visible=true; this.WindowState =  FormWindowState.Normal; this.Activate(); } else {   WindowState=FormWindowState.Minimized;   this.Visible=false; } }  
    private void fm_Main_Resize(object sender, System.EventArgs e) { if (this.WindowState == FormWindowState.Minimized) { this.Visible = false; this.notifyIcon1.Icon = this.Icon; this.notifyIcon1.Text = this.Text; this.notifyIcon1.Visible = true; } }private void notifyIcon1_Click(object sender, System.EventArgs e) { this.Visible = true; this.WindowState = FormWindowState.Normal; this.notifyIcon1.Visible = false;} 
     
      

  2.   

    http://www.csdn.net/Develop/Read_Article.asp?Id=20992
      

  3.   

    点击关闭,隐藏窗体显示托盘的图标, 双击图标打开窗体private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
    {
    e.Cancel =true;
    this.Hide ();
    this.notifyIcon1.Visible =true;
    }private void notifyIcon1_DoubleClick(object sender, System.EventArgs e)
    {
    if(this.Visible ==true) //根据窗口的显示和隐藏设置Trayico对象的显示
    {
    this.Hide();
    this.notifyIcon1 .Visible =true;
    }
    else
    {
    this.Show();
    this.notifyIcon1.Visible =false;
    }
    }
      

  4.   

    将上下文菜单notification关联上
      

  5.   

    http://www.yesky.com/20020110/213425.shtml
      

  6.   

    public Form1()
    {
    //
    // Required for Windows Form Designer support
    //
    InitializeComponent();
    //
    // TODO: Add any constructor code after InitializeComponent call
    //
    m_bFlag=true;
    m_bShowWnd=true;try
    {
    m_Icon1 = new Icon("Icon1.ico");//导入图标文件
    m_Icon2 = new Icon("Icon2.ico");
    }
    catch ( Exception e )
    {
    MessageBox.Show("Error " + e.Message,"Animate Tray - Error");
    menuItem2.Enabled = false;
    menuItem3.Enabled = false;
    }
    }添加menuItem1、menuItem2、menuItem3、m_trayIcon的Click事件,消息处理函数如下:
    private void menuItem1_Click(object sender, System.EventArgs e)
    {
    timer1.Start();//打开计时器
    }private void menuItem2_Click(object sender, System.EventArgs e)
    {
    timer1.Stop();//停止计时器
    }private void menuItem3_Click(object sender, System.EventArgs e)
    {
    Application.Exit();//退出应用程序
    }private void m_trayIcon_Click(object sender, System.EventArgs e)
    {
    if(m_bShowWnd == true)//隐藏主界面
    {
    this.Visible = false;
    m_bShowWnd = false;
    }
    else//显示主界面
    {
    this.Visible = true;
    m_bShowWnd = true;
    }

    最后还要添加timer1的Tick()函数: private void timer1_Tick(object sender, System.EventArgs e)
    {
    if ( m_Icon1 != null && m_Icon2 != null ) //如果两个图标文件都被正确载入
    {
    //只要timer1被启动,则在两个图标之间不断进行选择变换,实现动画效果
    if ( m_bFlag == true )
    {
    m_trayIcon.Icon = m_Icon2;
    m_bFlag = false;
    }
    else
    {
    m_trayIcon.Icon = m_Icon1;
    m_bFlag = true;
    }
    }