1

I'm trying to display the application on the system tray(right bottom side of the screen) on click of the minimize button.. my application succeeds on removing the display from the taskbar but It fails to display it on the system tray can someone please check my code and tell me if I am missing something?

I'm using Windows 10 and VS 2013

First I have dragged a notigyIcon from the toolbox to my form1 and named it to myTrayIcon.

protected override void OnResize(EventArgs e)
    {
        base.OnResize(e);

        if (this.WindowState  == FormWindowState.Minimized)
        {
            this.ShowInTaskbar = false;
            this.myTrayIcon.Visible = true;
            this.Hide();
        }
    }

so When I click on the minimize button the window is hidden but the trayIcon is not display.. what is wrong with the code? am I missing anything?

Asım Gündüz
  • 1,257
  • 3
  • 17
  • 42

1 Answers1

0

Try with adding the method "ShowBalloonTip":

  if (this.WindowState  == FormWindowState.Minimized)
    {
        this.ShowInTaskbar = false;
        this.myTrayIcon.Visible = true;
        this.myTrayIcon.ShowBalloonTip(30000);
        this.Hide();
    }
Luca.A
  • 59
  • 1
  • 6