0

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

Zorak
  • 709
  • 7
  • 24
  • Put `this.Show();` in your DoubleClick event, before the WindowState line. – LarsTech Aug 09 '17 at 16:06
  • @OwenPauling Thank you for this. After a little tweak, it is working for me. After restoring, it will not focus the window, but it does not matter, so this is solution for me. Thank you. – Zorak Aug 09 '17 at 16:47

0 Answers0