I've tried to minimize my app to tray and use NotifyIcon to display the balloon info about it. Since the balloon tip did not show, I assumed that I am doing something wrong, so I made a very basic app to test that with examples that I found and try to figure out what I am doing wrong. Even that examples do not work for me. I found that there are cases when the balloon tip won't show (NotifyIcon.ShowBalloonTip Issues : C# 411). To the best of my knowledge, none of the conditions when the balloon won't show are satisfied. I even tried the .NET 4.8.1 instead of the NET6 (just in case there are some differences between them. I could easily work around it by creating a popup window, but I really would like to find out what I'm doing wrong. I add the code of the very minimal test app below (it all works as expected, except that the balloon tit does not work):
NotifyTest:
namespace NotifyTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
notifyIcon1.Visible = true;
}
private void Form1_SizeChanged(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
notifyIcon1.Icon = SystemIcons.Exclamation;
notifyIcon1.BalloonTipText = "Minimized to tray";
notifyIcon1.ShowBalloonTip(1000);
this.ShowInTaskbar = false;
}
else if (this.WindowState == FormWindowState.Normal)
{
notifyIcon1.BalloonTipText = "We're back";
notifyIcon1.ShowBalloonTip(1000);
}
}
private void notifyIcon1_DoubleClick(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Normal;
}
}
}