NotifyIcon.ShowBalloonTip 未显示气球
我在一些我认为很容易的事情上遇到了麻烦...... 我无法让我的 NotifyIcon 显示气球提示。 基本代码是:
public void ShowSystrayBubble(string msg, int ms)
{
sysTrayIcon.Visible = true;
sysTrayIcon.ShowBalloonTip(20, "Title", "Text", ToolTipIcon.None);
}
执行此代码时没有任何反应。 我读到超时参数可能以秒或毫秒为单位,无法判断,所以我尝试了两者,但都不起作用。
我使用的是WinXP,.NET 3.5。
I'm having trouble with something that I thought would be easy...
I can't get my NotifyIcon to show a balloon tip. The basic code is:
public void ShowSystrayBubble(string msg, int ms)
{
sysTrayIcon.Visible = true;
sysTrayIcon.ShowBalloonTip(20, "Title", "Text", ToolTipIcon.None);
}
Nothing happens when I execute this code. I read that the timeout arg may be in seconds or ms, can't tell, so I tried both and neither works.
I'm using WinXP, .NET 3.5.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我挫败了自己......事实证明这是操作系统级别的问题。 几周前,我已经通过注册表禁用了所有气球。
您可以在此处阅读有关如何在 WinXP 中禁用气球提示的信息:
http://support.microsoft.com/kb/307729
要启用它们,只需设置注册表值改为 1,然后再次登录/重新启动。
I had foiled myself... This turned out to be an issue at the OS level. I had previously disabled all balloons via the registry a few weeks ago.
You can read the information here on how to disable balloon tips in WinXP:
http://support.microsoft.com/kb/307729
To enable them, just set the registry value to 1 instead and logon again/restart.
然后,您应该记录消息,以便已禁用气球的用户能够在需要时查看它们。 如果您可以获得读取注册表的权限,则可以检查该值并采取相应的操作(不是修改该值,而是记录或显示气球)。
You should then log the messages for users who have disabled the balloons be able to go review them in case of need. If you can get permissions to read the registry, you could check the value and act accordingly (not to modify the value, but to log or to show the balloon).
请参阅此内容,它涵盖了鼠标单击与 NotifyIcon 的所有组合以及更多内容。 该代码位于模板中,并且是项目设置驱动的,因此您可以在所有项目中实现 NotifyIcon 逻辑,而无需进行任何编码。
更多信息请参见
http://code.msdn.microsoft.com/TheNotifyIconExample
Please see this it covers all combinations of mouse clicks with NotifyIcon as well as much more. The code is located in a template and is project setting driven so that you can implement NotifyIcon logic in all your projects with no coding effort at all.
More Here
http://code.msdn.microsoft.com/TheNotifyIconExample