C# 气球未显示 NotifyIcon.ShowBalloonTip

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/193855/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-03 17:30:23  来源:igfitidea点击:

Balloon not showing up with NotifyIcon.ShowBalloonTip

c#.netnotifyiconsystray

提问by greg7gkb

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:

我遇到了一些我认为很容易的事情……我无法让我的 NotifyIcon 显示气球提示。基本代码是:

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.

当我执行这段代码时什么也没有发生。我读到超时 arg 可能以秒或毫秒为单位,无法判断,所以我尝试了两者,但都不起作用。

I'm using WinXP, .NET 3.5.

我使用的是 WinXP、.NET 3.5。

采纳答案by greg7gkb

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

您可以在此处阅读有关如何在 WinXP 中禁用气球提示的信息:http: //support.microsoft.com/kb/307729

To enable them, just set the registry value to 1 instead and logon again/restart.

要启用它们,只需将注册表值设置为 1,然后再次登录/重新启动。

回答by Vinko Vrsalovic

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).

然后,您应该为禁用气球的用户记录消息,以便在需要时查看它们。如果您可以获得读取注册表的权限,您可以检查该值并采取相应措施(不是修改值,而是记录或显示气球)。

回答by Vinko Vrsalovic

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.

请参阅此内容,它涵盖了使用 NotifyIcon 以及更多鼠标点击的所有组合。代码位于模板中,由项目设置驱动,因此您可以在所有项目中实现 NotifyIcon 逻辑,而无需进行任何编码工作。

More Here

更多在这里

http://code.msdn.microsoft.com/TheNotifyIconExample

http://code.msdn.microsoft.com/TheNotifyIconExample