Application.Idle 仅在我将鼠标悬停在托盘图标上后触发
我想在程序的 Application.Idle 事件中显示 BalloonTip,但由于某种原因,Application.Idle 事件仅在我将鼠标悬停在 NotifyIcon 上后才会触发。什么给?
I want to show a BalloonTip in the Application.Idle event of my program, but for some reason the Application.Idle event only fires after I mouse over the NotifyIcon. What gives?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您确定
Application.Idle
没有被解雇吗?简单的方法是每当代码进入事件时登录到文件并查看是否发生这种情况。另请理解,此事件可能不适合您的需求 - 当消息泵变空时(通常没有键盘/鼠标输入),它会发生 - 因此您可能会过于频繁地收到此事件(请参阅 这个SO线程了解更多)。在这种情况下,我怀疑窗口可能会抑制气球尖端,因为它显示得太频繁。
因此,您可以编码以仅在最后 2-3 秒内未显示提示时显示提示。您可能需要查看空闲检测的不同实现来满足您的要求 - 请查看:
Are you sure that
Application.Idle
is not getting fired? Simple way would be to log into the file whenever code enters the event and see if this happening.Also understand that this event may not be suitable for your needs - it happens when message pump becomes empty (typically no keyboard/mouse input) - so as such you would probably receive this event too frequently (see this SO thread to understand more). In this case, I suspect that windows is suppressing the balloon tip perhaps because it is being shown too frequently.
As such, you can code to show the tip only if it has not been shown say in last 2-3 seconds. You may want to look at different implementations of Idle detection to suit your requirements - have a look at: