Let us learn how to minimize Application to System Tray

Posted by in C# category on for Beginner level | Points: 250 | Views : 6012 red flag

In this article we will see how we can minimize the application to system tray when we click on Minimize Button


Some time back working on Windows Application we were assigned a task to minimize the application to System Tray so that it run in background.In order to do it we will see how we can achieve the following.


  1. Understand the Notify Icon for Minimizing the Application.
  2. Understanding Form Re-size event.
  3. Understanding Notify Icon Mouse Double Click 

Using the code

  1. Create a New Windows Application in VS2010.
  2. Drag and Drop NotifyIcon from toolbox.
  3. Now on FormLoad event we will set the BalloonTipText Property to the Text that we want to show.
Notify Icon Properties Used :-
  1. BalloonTipText Property is used to set the text of the NotifyIcon.
  2. BalloonTipTitle Property is normally used to name the Application which is minimized.

Form1_Resize Event :-

  1. This event will help us to recognize whether we have clicked the minimized  button and when we click the button we are setting the ShowInTaskbar property of Windows form to False
  2. We then go ahead make the Notify Icon Visible and set the time to show the Balloontooltip using the BalloonToolTip Method to show the BalloonTooltip and we assign time in milliseconds.
  3. Over here we are showing to BalloonToolTip for 3 Seconds i.e 3000 milliseconds. 

Notify Icon Mouse Double Click 

  1. In this event we follow the reverse process of Form1_Resize Event we first show the Application in task bar by setting the ShowInTaskbar property of Windows form to true
  2. We then go ahead and invisible the Notify Icon by setting the Visible property to false.
  3. Then we restate the Windows form to Normal.

Let us Start Implemention
// Code Behind.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MinimisedApplicationtoTray
    public partial class Form1 : Form
        public Form1()

        private void Form1_Load(object sender, EventArgs e)
            // Setting the text and title of Notify Icon
            notifyIcon1.BalloonTipText = "Application Minimised to System Tray";
            notifyIcon1.BalloonTipTitle = "Dot Net Funda";

        private void Form1_Resize(object sender, EventArgs e)
            // Checking the Windows State if we have clicked Minimised button then we execute the following logic
            if (WindowState == FormWindowState.Minimized)
                ShowInTaskbar = false;
                notifyIcon1.Visible = true;

        // Re-setting the window to normal State.
        private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
            ShowInTaskbar = true;
            notifyIcon1.Visible = false;
            WindowState = FormWindowState.Normal;

OutPut Screen 1 : Running Application

Output 2 :- Minimizing the Application to System Tray


In order to have an Icon for the Notify Icon we can only use .ICO file type extension.

To convert any Image to Icon you can use the following link :- http://www.icoconverter.com/

Page copy protected against web site content infringement by Copyscape

About the Author

Full Name: Raj Trivedi
Member Level:
Member Status: Member,MVP
Member Since: 6/16/2012 2:04:41 AM
Country: India
Regard's Raj.Trivedi "Sharing is Caring" Please mark as answer if your Query is resolved
Raj Trivedi i.e. me started my career as Support Professional and then moved on the Software development eventually reached at these skills Software Development | Enthusiastic Blogger | Content Writer | Technical Writer | Problem Solver | Lecturer on Technology Subjects | Runnerup Award Winner on www.dotnetfunda.com and firm believer in Sharing as a way of Caring Yet this much achieved its still a long way to go and there is biggest dream lying to be one of the best entrepreneurs of India in Technology Department. The Dream has just started and i hope it follows. Highlights are mentioned in details in my profile at http://in.linkedin.com/pub/raj-trivedi/30/61/b30/

Login to vote for this post.

Comments or Responses

Posted by: Shitalr on: 8/27/2013 | Points: 25
I tried this but i m getting error while i select image for notifyicon which i created in paint as .ico it gives error like attribute should be a picture.
Posted by: Raj.Trivedi on: 8/27/2013 | Points: 25

do not make ico in paint,
save it as bitmap and go to www.icoconverter.com and convert the image

Login to post response

Comment using Facebook(Author doesn't get notification)