Skip to content

An an easy-to-use library for displaying NotifyIcon (notification icon) in both WPF and WinForms applications, offering non-intrusive system notifications and quick access functionality in the taskbar.

License

HeHang0/NotifyIcon

Repository files navigation

NotifyIcon NuGet Build AutoUpdate

NotifyIcon is an easy-to-use library for displaying NotifyIcon (notification icon) in both WPF and WinForms applications, offering non-intrusive system notifications and quick access functionality in the taskbar.

Usage


NotifyIcon is available as NuGet package.

using PicaPico;

string GetExePath()
{
    Process currentProcess = Process.GetCurrentProcess();
    return currentProcess.MainModule?.FileName ?? string.Empty;
}

var notifyIcon = new NotifyIcon()
{
    Text = "NotifyIcon",
    Icon = System.Drawing.Icon.ExtractAssociatedIcon(GetExePath())
};
var menuFirst = notifyIcon.AddMenu("MenuItem1");
menuFirst.Margin = new System.Windows.Forms.Padding(0, 2, 0, 0);
notifyIcon.AddMenu("MenuItem2", true);
notifyIcon.AddMenu("MenuItem3", onClick);
var menuLast = notifyIcon.AddMenu("Exit", (sender, e) => { Current.Shutdown(); });
menuLast.Margin = new System.Windows.Forms.Padding(0, 0, 0, 2);
notifyIcon.BalloonTipShown += OnBalloonTipShown;

void OnBalloonTipShown(object? sender, EventArgs e)
{
    MessageBox.Show("OnBalloonTipShown");
}
void onClick(object? sender, EventArgs e)
{
    notifyIcon.BalloonTipTitle = "Title";
    notifyIcon.BalloonTipText = "This Balloon Tips";
    notifyIcon.ShowBalloonTip(5);
}

Repository


The source code for NotifyIcon is hosted on GitHub. You can find it at the following URL: https://github.com/HeHang0/NotifyIcon

License


NotifyIcon is released under the MIT license. This means you are free to use and modify it, as long as you comply with the terms of the license.

About

An an easy-to-use library for displaying NotifyIcon (notification icon) in both WPF and WinForms applications, offering non-intrusive system notifications and quick access functionality in the taskbar.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages