【转载】
首先在窗体中添加一个 notifyIcon1控件 ,
Then:
//添加事件《实现最小化之后任务栏显示图标》 private void Form1_StyleChanged(object sender, EventArgs e) { if (this.WindowState == FormWindowState.Minimized) { this.notifyIcon1.Visible = true; this.Visible = false; } }
//双击图标之后显示窗体 private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e) { this.Visible = true; this.WindowState = FormWindowState.Normal; this.notifyIcon1.Visible = false; }