winform最小化后隐藏到右下角,单击或双击后恢复
notifyIcon控件。
下面的代码
private void MainForm_Resize(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
this.WindowState = FormWindowState.Normal;
notifyIcon1.Visible = true; this.Hide();
this.ShowInTaskbar = false;
}
}
private void notifyIcon1_MouseClick(object sender, MouseEventArgs e)
{
if (this.ShowInTaskbar == false) notifyIcon1.Visible = true;
this.ShowInTaskbar = true;
this.Show();
this.Activate();
this.WindowState = FormWindowState.Normal;
}
这个是在.NET环境下运行的。