as you can see in the code below, the form will be hidden if the deactivate event is triggered, and the form will be shown again if notifyIcon clicked, the problem is, when form state is visible, then notifyIcon is clicked, the form will be hidden and immediatly shown again, I do not want this behavior, please someone help me.
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();
}
}