Articles → CSHARP → Notifyicon In C#
Notifyicon In C#
Purpose
Click to Enlarge
Example
using System;
using System.Windows.Forms;
namespace NotifyIconDemo {
public partial class Form1: Form {
public Form1() {
InitializeComponent();
}
NotifyIcon notifyIcon = new NotifyIcon();
private void btnNotifyIcon_Click(object sender, EventArgs e) {
notifyIcon.Visible = true;
this.WindowState = FormWindowState.Minimized;
this.ShowInTaskbar = false;
notifyIcon.ShowBalloonTip(10000);
}
private void Form1_Load(object sender, EventArgs e) {
notifyIcon.Icon = System.Drawing.Icon.ExtractAssociatedIcon("images\\favicon.ico");
notifyIcon.Text = "Notify Icon Message";
notifyIcon.BalloonTipText = "Notify Balloon Message";
notifyIcon.DoubleClick += NotifyIcon_DoubleClick;
}
private void NotifyIcon_DoubleClick(object sender, EventArgs e) {
notifyIcon.Visible = false;
this.WindowState = FormWindowState.Normal;
this.ShowInTaskbar = true;
}
}
}
Output
Click to Enlarge
Click to Enlarge