有没有办法让气球尖永远不会关闭?
我的应用程序是一个监视器,可以在用户离开时在后台运行,其目的是在发生某些更改时以视觉方式提醒用户。消息框看起来有点令人讨厌,所以我认为气球提示可以完成任务,而不会扰乱焦点,以防它们碰巧在做某事。
不幸的是,这需要一个超时参数。我希望它无限期地保留,直到用户关闭它。
这可能吗?
My application is a monitor that may run in the background while the user is away, and its purpose is to visually alert the user when some changes have occurred. MessageBoxes seem a little obnoxious, so I figure a Balloon Tip will accomplish the task without messing with the focus in case they happen to be doing something.
Unfortunately, the thing requires a timeout parameter. I would like for it to stay indefinitely until the user closes it.
Is this possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Windows 已经解决了这个问题。超时计数器在检测到键盘或鼠标输入之前不会开始计时。来自 NotifyIcon.ShowBalloonTip 的备注部分:
This is already taken care of by Windows. The timeout counter doesn't start ticking until it detects keyboard or mouse input. From the Remarks section of NotifyIcon.ShowBalloonTip:
据我所知,不可能指定无限超时。
也就是说,如果您将超时设置为 Int32.MaxValue,工具提示将等待 2,147,484 秒,即大约 25 天。那时您的用户很可能已经注意到工具提示,或者他/她永远不会。
编辑: @Hans Passant 提到了一个系统设置,该设置对超时值设置了上限,因此......这可能根本不起作用。无论如何,他的答案更好。
As far as I can tell, it's not possible to specify an infinite timeout.
That said, if you set the timeout to Int32.MaxValue, the tooltip will wait for 2,147,484 seconds, i.e. roughly 25 days. Chances are that your user will have noticed the tooltip by then, or that he/she never will.
EDIT: @Hans Passant mentions a system setting that puts an upper bound on the timeout value, so... that probably won't work after all. His answer is better anyway.