#region 窗体最小化到状态栏
private void MainForm_FormClosing(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{ e.cancel= true; //取消关闭窗体事件
notifyIcon1.Visible = true;
this.Hide();
this.ShowInTaskbar = false;
}
} private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e) //双击最小化图标显示窗体
{
if (this.ShowInTaskbar == false)
{
notifyIcon1.Visible = true;
this.ShowInTaskbar = false;
this.Show();
this.Activate();
this.WindowState = FormWindowState.Normal;
}
}