Make baloonTipText visible until click

I have a NotifyIcon in my program that displays a toolbar hint. I wrote the code as

 notifyIcon1.Icon = new Icon(SystemIcons.Application, 40, 40); notifyIcon1.Visible = true; notifyIcon1.Text = "Test Notify Icon Demo"; notifyIcon1.BalloonTipText =count+ " Alerts"; notifyIcon1.BalloonTipIcon = ToolTipIcon.Info; notifyIcon1.BalloonTipTitle = "Alert!"; notifyIcon1.ShowBalloonTip(999999999); 

The balloon tip is not visible after the set time (999999999). But I want to show the tooltip on the ball until it is pressed, because I have a baloontipclicked event.

How to make a balm visible forever?

+4
source share
2 answers

from MSDN:

The minimum and maximum timeout values ​​are activated and usually are 10 and 30 seconds, however this may vary depending on the operating system. Timeout values ​​that are too large or too small are adjusted to the corresponding minimum or maximum value. In addition, if the user does not seem to be using a computer (no keyboard or mouse events occur), then the system does not calculate this timeout time.

It seems that it is not possible to override the maximum timeout (eventually configured by Windows and limited to 30 seconds, even if you specify a longer one) so that the notification disappears, will not wait until you click on it after 2 minutes.

if you want to truly have different behavior, you should probably use something else, other objects, or simulate something similar to forms where you have full control over the behavior and you can show, hide and close, as you want from your code.

+7
source

You can show it again if it has not been pressed. You have a close event (BalloonTipClosed), if the user has not viewed it, just show it again.

 private void ShowBalloonTip(int minutes) { notifyIcon.BalloonTipIcon = ToolTipIcon.Error; notifyIcon.BalloonTipText = "Text"; notifyIcon.BalloonTipTitle = "Title"; notifyIcon.ShowBalloonTip(minutes* 60 * 1000); m_showUntil = DateTime.Now.AddMinutes(minutes); } private void notifyIcon_BalloonTipClosed(object sender, EventArgs e) { if (m_showUntil > DateTime.Now) notifyIcon.ShowBalloonTip(60 * 1000); } private void notifyIcon_BalloonTipClicked(object sender, EventArgs e) { m_showUntil = DateTime.MinValue; (..) } 
+7
source

All Articles