Friday, January 1, 2016

Example of NotifyIcon system tray in windows form c#

10:16 PMFriday, January 1, 2016
If you want to show your windows form application in NotifyIcon toolBar then you can use this example. When you press minimize button of windows form then your application should minimized in system tray. 
Try these steps to minimized your application as System Tray:
Step-1 : Add a new  windows form into your project
Step-2 : Add a NotifyIcon control in currently added form.
Step-3 : Select Show smart tag, add icon file in NotifyIcon control.

Step-4 : Add the following code in code file with respective events

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication5
    public partial class Form3 : Form
        public Form3()

        private void Form3_Resize(object sender, EventArgs e)
            if (WindowState==FormWindowState.Minimized)

                ShowIcon = false;
                notifyIcon1.Visible = true;

        private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
            ShowInTaskbar = true;
            notifyIcon1.Visible = false;
            WindowState = FormWindowState.Normal;

        private void Form3_Load(object sender, EventArgs e)
            notifyIcon1.BalloonTipText = "Application minimized";
            notifyIcon1.BalloonTipTitle = "";

Code generates the following output
Example of NotifyIcon system tray in windows form c#

Protected by Copyscape Online Copyright Protection Software


Post a Comment

Toggle Footer