C# 窗体最小化到状态栏 双击正常显示窗体 (contextMenustrip 设置右键菜单)
首先在窗体中添加一个 notifyIcon1控件
//最小化时
private void Form1_SizeChanged(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
this.notifyIcon1.Visible = true;
this.Visible = false;
}
}
//鼠标双击任务栏图标显示程序界面:
private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
{
if (this.Visible == false)
this.Visible = true;
}