强制 NotifyIcon 显示在系统托盘中
我有一个 NotifyIcon 出现在系统托盘中,我想在应用程序第一次空闲时显示气球提示(如此处建议的:C# 在 application.run() 之后执行代码),但 Idle 事件发生在图标出现在系统托盘之前,导致气球不出现。如何强制在调用 ShowBalloonTip 之前显示 NotifyIcon?
I have a NotifyIcon that appears in the system tray and I want to show a balloon tip the first time stuff the application is idle (As suggested here: C# execute code after application.run() ) but the Idle event happens before the Icon appears in the System tray, causing the balloon to not appear. How can I force the NotifyIcon to appear before I call ShowBalloonTip?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为什么不在空闲时设置一个标志,然后在将通知图标设置为可见后检查标志的状态:
然后:
Why not set a flag on idle and then check the state of the flag after setting the notify icon to visible:
Then:
这是一个相当基本的比赛,这是另一个处理图标的过程。 Windows 资源管理器。你无法判断它什么时候处理了事情。在设置
Visible = true
后调用Thread.Sleep(500)
应该会显着提高几率。请考虑在程序启动时显示该图标。
This is a fairly fundamental race, it is another process that takes care of the icon. Windows Explorer. You can't tell when it took care of things. Calling
Thread.Sleep(500)
after settingVisible = true
ought to improve the odds significantly.Do consider displaying the icon when your program starts.