托盘程序的制作: 1.把NotifyIcon控件拉一个到窗体上,并设置NotifyIcon的Icon(很重要!否则运行后看不到效果) 2.窗体关闭时,将程序最小化到系统托盘上 private void Form1_FormClosing(object sender, FormClosingEventArgs e) 3.放一个上下文菜单,添加几个基本项,"显示主窗体","退出" ,将这个菜单挂到NotifyIcon上 private void menuShow_Click(object sender, EventArgs e) 4.左键单击托盘图标时,显示主窗体,右击时当然是弹出上面设置的菜单 private void notifyIcon1_MouseClick(object sender, MouseEventArgs e)} 防止这个程序同时运行多个 using System;using System.Collections.Generic;using System.Windows.Forms;using System.Threading;namespace LuceneTest} 相关文章: