需要加一个 notifyIcon1控件,希望设置图标,最后就可以加下面2个事件就行了
private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
{
this.TopMost = true;
this.Show();
this.notifyIcon1.Visible = false;
this.WindowState = FormWindowState.Normal;
}
private void Form3_SizeChanged(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
this.Hide();
this.notifyIcon1.Visible = true;
}
}