//窗体最小化时候将窗体隐藏掉,同时让托盘控件显示
private void Form1_SizeChanged(object sender, EventArgs e)
{
if(this.WindowState == FormWindowState.Minimized)
{
this.Hide();
this.notifyIcon1.Visible = true;
}
}

private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
{
ShowDlg();
}

private void MinToIcon()
{
this.Hide();
this.ShowInTaskbar = false;
this.notifyIcon1.Visible = true;
}
private void ShowDlg()
{
this.Show();
this.ShowInTaskbar = true;
this.notifyIcon1.Visible = false;
}
//这里添加了右键属性
private void 打开ToolStripMenuItem_Click(object sender, EventArgs e)
{
ShowDlg();
}

private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Dispose(true);
Application.ExitThread();
}

 

相关文章:

  • 2021-09-24
  • 2021-08-08
  • 2022-12-23
  • 2021-09-19
  • 2021-06-05
  • 2022-12-23
  • 2022-01-12
猜你喜欢
  • 2021-12-05
  • 2021-07-25
  • 2021-11-12
  • 2021-07-04
相关资源
相似解决方案