-2

I want to use NotifyIcon, but I don't want any icons to appear in the lower right field, is this possible? Or does anyone have an alternative solution suggestion? I want to send a notification until the user sees the notification, the visibility will be turned on, but there will not be any icon in the lower right part. It will only appear in the notification panel on the right.

I tried to hide icon.But couldn't.

Hakan
  • 19
  • 3

2 Answers2

1

Set NotifyIcon.Visible = false

alternatively you could use the Windows Toast notification if you are using .net5.0 or higher.

As described on Microsofts site, it only works with specific TFs.

.net6 is given on MS Site, for .net5 you can use <TargetFramework>net5.0-windows10.0.17763.0</TargetFramework>

N0m4n904
  • 123
  • 2
  • 13
0

A workaround would be to only show the NotifyIcon during the time the notification is displayed and hide it immediately after. Here's a complete example:

public Form1()
{
    InitializeComponent();
    notifyIcon1.Visible = false;
    notifyIcon1.BalloonTipClosed += notifyIcon1_BalloonTipClosed;
}

private void button1_Click(object sender, EventArgs e)
{
    notifyIcon1.Visible = true;
    notifyIcon1.ShowBalloonTip(1000, "Title", "Some text here", ToolTipIcon.Info);
}

private void notifyIcon1_BalloonTipClosed(object sender, EventArgs e)
{
    notifyIcon1.Visible = false;
}
  • When I do this, too many empty icons accumulate in the system tray. I guess i tried something like this. – Hakan Oct 31 '22 at 06:22
  • @Hakan No, that shouldn't happen. The icon should only appear while the notification is displayed. Did you try this exact code? – 41686d6564 stands w. Palestine Oct 31 '22 at 06:26
  • I will try now. When i tried it i write the result wait a little please. – Hakan Oct 31 '22 at 06:27
  • I tried it but if i set the visibility to false, there isnt any notification on notification panel. – Hakan Oct 31 '22 at 06:31
  • @Hakan That's why you need to set the visibility to _true_ before you show the notification and then switch it back to false right after. Did you try to do that? There's a complete example in the answer. You can start a new project, add a button and a NotifyIcon, then copy and paste the code to test it. If it works (it should), you can then adapt the code to work with your actual project. – 41686d6564 stands w. Palestine Oct 31 '22 at 06:41
  • I guess i couldn't quite explain myself but i had solution. Thanks for your help and your patient :) – Hakan Oct 31 '22 at 06:43