Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combine NotifyIcon and ToolTip

I have been working with NotifyIcon in order to show an icon in the taskbar. This program has no Windows Form. I perhaps could create one and make it invisible but I was hoping to avoid it. The ToolTip functions attached to NotifyIcon are somewhat lacking, and one of the gurus here suggested I look at the ToolTip functionality. It is possible to attach ToolTip to a form. Is is possible to attach it to just the NotifyIcon? I'm trying do this:

NotifyIcon CTicon = new NotifyIcon();
ToolTip toolTip = new ToolTip();
toolTip.SetToolTip(CTicon, "Test");

And I get the error "cannot convert from 'System.Windows.Forms.NotifyIcon' to 'System.Windows.Forms.Control'. Is there a way to convert? I also tried:

toolTip.SetToolTip(CTicon.Container, "Test");

but a container is apparently not a valid control either. I apologize for my total lack of understanding of how this may or may not work.

Thanks in advance.

like image 679
Greycrow Avatar asked Mar 11 '10 17:03

Greycrow


2 Answers

A belated answer, but maybe useful for others .

NotifyIcon.Text = "ToolTipText";
like image 134
prabhakaran Avatar answered Oct 07 '22 22:10

prabhakaran


Tray icons don't support square tool tips, only balloons. Kinda makes sense, the icons are usually quite close together so it would be hard to see what icon produced the tip without the "stem" on the balloon. Use the NotifyIcon.BalloonTipText property.

like image 41
Hans Passant Avatar answered Oct 08 '22 00:10

Hans Passant