看看这篇文章,对你应该有帮助,
http://www.vchome.net/dotnet/dotnetdocs/dotnet39.htm
帮你顶一下...

解决方案 »

  1.   

    给你个我作的例子:using System;
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;
    using System.Data;namespace test
    {
    /// <summary>
    /// Form1 的摘要说明。
    /// </summary>
    public class Form1 : System.Windows.Forms.Form
    {
    private System.Windows.Forms.Button button1;
    private System.Windows.Forms.NotifyIcon notifyIcon1;
    private System.Windows.Forms.ContextMenu contextMenu1;
    private System.Windows.Forms.MenuItem menuItem1;
    private System.ComponentModel.IContainer components; public Form1()
    {
    //
    // Windows 窗体设计器支持所必需的
    //
    InitializeComponent(); //
    // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
    //
    } /// <summary>
    /// 清理所有正在使用的资源。
    /// </summary>
    protected override void Dispose( bool disposing )
    {
    if( disposing )
    {
    if (components != null) 
    {
    components.Dispose();
    }
    }
    base.Dispose( disposing );
    } #region Windows 窗体设计器生成的代码
    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {
    this.components = new System.ComponentModel.Container();
    System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
    this.button1 = new System.Windows.Forms.Button();
    this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
    this.contextMenu1 = new System.Windows.Forms.ContextMenu();
    this.menuItem1 = new System.Windows.Forms.MenuItem();
    this.SuspendLayout();
    // 
    // button1
    // 
    this.button1.Location = new System.Drawing.Point(40, 40);
    this.button1.Name = "button1";
    this.button1.TabIndex = 0;
    this.button1.Text = "点击我最小化";
    this.button1.Click += new System.EventHandler(this.button1_Click);
    // 
    // notifyIcon1
    // 
    this.notifyIcon1.ContextMenu = this.contextMenu1;
    this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
    this.notifyIcon1.Text = "我的应用程序";
    this.notifyIcon1.Click += new System.EventHandler(this.notifyIcon1_Click);
    // 
    // contextMenu1
    // 
    this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
     this.menuItem1});
    // 
    // menuItem1
    // 
    this.menuItem1.Index = 0;
    this.menuItem1.Text = "复原";
    this.menuItem1.Click += new System.EventHandler(this.notifyIcon1_Click);
    // 
    // Form1
    // 
    this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
    this.ClientSize = new System.Drawing.Size(292, 269);
    this.Controls.Add(this.button1);
    this.Name = "Form1";
    this.Text = "Form1";
    this.Load += new System.EventHandler(this.Form1_Load);
    this.VisibleChanged += new System.EventHandler(this.Form1_VisibleChanged);
    this.ResumeLayout(false); }
    #endregion /// <summary>
    /// 应用程序的主入口点。
    /// </summary>
    [STAThread]
    static void Main() 
    {
    Application.Run(new Form1());
    } private void button1_Click(object sender, System.EventArgs e)
    {
    this.WindowState = FormWindowState.Minimized;
    this.Hide();
    } private void Form1_VisibleChanged(object sender, System.EventArgs e)
    {
    notifyIcon1.Visible = !this.Visible; // 如果窗口显示,托盘托表就不显示,如果窗口隐藏,托盘图标就显示
    } private void notifyIcon1_Click(object sender, System.EventArgs e)
    {
    this.Show();
    this.WindowState = FormWindowState.Normal;
    } private void Form1_Load(object sender, System.EventArgs e)
    {

    }
    }
    }
      

  2.   

    谢谢各位大虾,特别是yangxd_yi(杨一)  AND  FJGoodGood(_FJ_强中强)