How to Minimize Application to Tray

Sharing is Caring

I’m not sure how many times I have been someone ask for help on the MSDN forums, email me, or come over and ask me in the case of coworkers. The steps to have an application minimized to tray are very simple.

      Create .NET Windows Application.
      Create .NET application.
      Add Tray Notifcation Icon to Windows form.
      Create Icon (using .NET, or other software). The icon should be 16×16
      Using either code or the visual editor you need to add the icon.
      As you may have noticed there’s no minimize event on the form. We need to use the form’s Resize Event and make sure that we check to see if the WindowState is Minimized. If the WindowState is minimized we need to make our form invisible and make the tray icon visible.
      Depending on your application, and how you have designed things you should use either the click or doubleclick events on the notifyicon to set the visibility of the form again and hide the trayicon again.

//No Minimize Event, so we need to use Resize event & check WindowState
private void frmMain_Resize(object sender, EventArgs e)
if (this.WindowState == FormWindowState.Minimized)
this.Visible = false;
notifyIcon1.Visible = true;

//Make form visible and notify icon invisible.
private void notifyIcon1_Click(object sender, EventArgs e)
this.Visible = true;
notifyIcon1.Visible = false;

Sharing is Caring

Brian is a software architect and technology leader living in Niagara Falls with 13+ years of development experience. He is passionate about automation, business process re-engineering, and building a better tomorrow.

Brian is a proud father of four: two boys, and two girls and has been happily married to Crystal for more than ten years. From time to time, Brian may post about his faith, his family, and definitely about technology.

Comments are closed.