如何在通知区域创建丰富的工具提示和丰富的气球
我一直想知道,每当您致电 ShowBalloonTip
方法href="https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.notifyicon?redirectedfrom=MSDN&view=netframework-4.8" rel="nofollow noreferrer">NotifyIcon
类,你会得到一个像这样的气球工具提示:
图1:标准气球工具提示
某些应用程序和 Microsoft 产品能够显示的不仅仅是那些“简单”的气球提示。
以下是一些示例:
图2:Windows更新气球工具提示
(来源:microsoft.com)
图3:硬件驱动安装气球提示
图4:硬件删除工具提示(程序:USB安全删除)
仔细观察图 2、3 和 4,您会发现它们不是标准的气球工具提示!
Fig2 具有不同的形状,可能是由于设置 Region
属性所致。它还具有一个比标准图标大得多的自定义图标 工具提示图标。
Fig3 使用标准形状(我认为),但它有一个自定义图标,不用说比默认的要大工具提示图标 大小。
Fig4 使用标准 ToolTipIcon 但它有不同的形状。
我的问题是如何创建在 .NET 通知区域中看到的“丰富”气球工具提示?我可以处理 WinAPI 并且它可以产生必要的输出。
I've been wondering, whenever you call the ShowBalloonTip
method of the NotifyIcon
class, you get a balloon tooltip like this:
Fig1: Standard Balloon Tooltip
Some applications and Microsoft products are able to display more than those 'simple' balloon tips.
Here are some samples:
Fig2: Windows Update Balloon Tooltip
(source: microsoft.com)
Fig3: Hardware Driver Installation Balloon Tooltip
Fig4: Hardware Removal Tooltip (Program: USB Safely Remove)
A good look at Figures 2, 3, and 4 reveals they aren't standard balloon tooltips!
Fig2 has a different shape, possibly from setting the Region
property. It also has a custom icon which is much bigger than the standard ToolTipIcon.
Fig3 uses the standard shape (I think) but it has a custom icon which needless to say is larger than the default ToolTipIcon size.
Fig4 uses a standard ToolTipIcon but it has a different shape.
My question is how does one create any of the 'rich' balloon tooltips that are seen in the notification area in .NET? I can handle WinAPI as well as it can produce the necessary output.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须使用 Win32 函数 Shell_NotifyIcon。您可以设置 NOTIFYICONDATA 结构到 NIIF_USER 以便为气球工具提示使用自定义图标。
在 Windows XP Service Pack 2 及更高版本上,您可以使用 hIcon 成员来指定自定义图标。
在 Windows Vista 及更高版本中,NOTIFYICONDATA 结构包含附加成员 hBalloonIcon。如果您已将 cbSize 成员设置为扩展 NOTIFYICONDATA 结构的正确大小,则可以使用此成员指定自定义图标。
You have to use the Win32 Function Shell_NotifyIcon. You can set the dwInfoFlags member of the NOTIFYICONDATA structure to NIIF_USER in order to use a custom icon for the balloon tooltip.
On Windows XP Service Pack 2 and later you can use the hIcon member to specify a custom icon.
On Windows Vista and later the NOTIFYICONDATA structure contains the addiional member hBalloonIcon. You can use this member to specify a custom icon if you have set the cbSize member to the correct size of the extended NOTIFYICONDATA structure.
看看这个:
http://www.codeproject.com/KB/WPF/WPF_TaskbarNotifier.aspx
或
www.codeproject.com/KB/WPF/wpf_notifyicon.aspx
其他选项是制作您自己的通知表单气球,
然后您将收到带有花朵背景和粉红色边框的通知:)
顺便说一句:它也可以有一些功能。
如本例所示:
https://i.sstatic.net/QtA0Y.jpg
<<图像示例
根据您的喜好创建一个表单,区域,控件等:)
代码如下:
顺便说一句,它们看起来都有点相同,但图标大小不同,
第一个可以向右对齐,而其他所有都向左对齐......
细微的色调变化等:)
Check this out:
http://www.codeproject.com/KB/WPF/WPF_TaskbarNotifier.aspx
or
www.codeproject.com/KB/WPF/wpf_notifyicon.aspx
Other option is to Make your own notification form balloon,
then you will have notification with flowers background and pink borders :)
BTW: that can have some functionality in it too.
As in this example:
https://i.sstatic.net/QtA0Y.jpg
<< Image Example
Create a form as you like, Region, Controls, Etc :)
and code something like:
BTW they all look kinda same, with different Icon size,
and the First one could fit to the right, while all other are aligned to left...
minor shade changes Etc. :)