隐藏,如下面代码中所示,如果停用事件被触发,窗体将被隐藏,如果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();
}
}
在http://stackoverflow.com/questions/7309098/c-sharp-toggle-form-visibility-on-notifyicon-click-and-看看hide-it-on-click-elsewher – coolmine
在你提到的问题中给出的解决方案仍然存在缺陷,因为如果用户点击的速度比指定的时间更快(在这种情况下为1000毫秒),那么表单将不会显示,我希望就像开始菜单的行为一样。 – nyongrand
请注意,它是刻度,而不是毫秒。 – coolmine