I have followed some guides and it seems to be a very simple task. still, I cannot make it work.
I can minimize app to tray:
private void Form1_Resize(object sender, EventArgs e)
{
if (FormWindowState.Minimized == this.WindowState)
{
ntfIcon.Visible = true;
ntfIcon.Icon = SystemIcons.Application;
ntfIcon.BalloonTipText = "Antispin";
ntfIcon.ShowBalloonTip(500);
this.Hide();
}
else if (FormWindowState.Normal == this.WindowState)
{
ntfIcon.Visible = false;
this.Show();
}
}
But I cannot make it restore from tray
private void ntfIcon_DoubleClick(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Normal;
}
Simply, the window will not show up, even adding this.Show()
after the windowstate
Any help please? Compiling winform under win10