正如您在下面的代码中看到的,如果触发了 deactivate 事件,表单将被隐藏,如果单击 notifyIcon,表单将再次显示,问题是,当表单状态可见时,单击 notifyIcon,表单将被隐藏并立即再次显示,我不希望这种行为,请有人帮助我。
private void FormMain_Deactivate(object sender, EventArgs e)
{
this.Hide();
}
private void notifyIcon_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
this.Show();
this.Activate();
}
}