1。首先拉入notifyIcon控件。
2。设置notifyIcon1的属性
            //
            // notifyIcon1
            //

            this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
            this.notifyIcon1.Text = "DBController";
            this.notifyIcon1.Visible = true;
            this.notifyIcon1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.notifyIcon1_MouseDoubleClick);
3。当中
        private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (this.Visible == false)
            {
                this.Visible = true;
            }
        }
双击为还原成主页面。
4。单击右键弹出contextMenu不是由事件设定的,而是由notifyIcon的属性设定的
//initialize notifyIcon
            notifyIcon1.ContextMenu = contextMenu1;
这里虽然我用的是VS2005,但是我还是习惯使用ContextMenu而非contextMenuStrip的对象,然后当点击右键,就会弹出contextMenu1这个对象了,怎么定义右键那?我不知道,现在