如何创建丰富的工具提示和丰富的气球通知区域 [英] How to create rich tooltips and rich balloons in notification area
问题描述
我一直在想,当你调用 ShowBalloonTip
方法的<一个href="http://msdn.microsoft.com/en-us/library/system.windows.forms.notifyicon.aspx"><$c$c>NotifyIcon$c$c>一流的,你会得到一个气球提示是这样的:
I've been wondering, whenever you call the ShowBalloonTip
method of the NotifyIcon
class, you get a balloon tooltip like this:
Fig1:标准气球工具提示
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更新气球工具提示
Fig2: Windows Update Balloon Tooltip
Fig3:硬件驱动程序的安装气球工具提示
Fig3: Hardware Driver Installation Balloon Tooltip
图四:硬件删除工具提示(计划:USB安全删除)
Fig4: Hardware Removal Tooltip (Program: USB Safely Remove)
好好看看图2,图3和4揭示它们不是标准的气球提示!
A good look at Figures 2, 3, and 4 reveals they aren't standard balloon tooltips!
Fig2 有不同的形状,可能是从设置区域
属性。它也有其比标准<一个更大的自定义图标href="http://msdn.microsoft.com/en-us/library/system.windows.forms.tooltipicon.aspx">ToolTipIcon.
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 使用标准形状(我认为),但它有一个自定义图标说哪个不用比默认的 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.
图四使用标准的 ToolTipIcon 但是它具有不同的形状。
Fig4 uses a standard ToolTipIcon but it has a different shape.
我的问题是一个人如何产生任何的是出现在通知区域中的.NET'富'的气球工具提示?我可以处理WinAPI的,以及它可以产生必要的输出。
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.
推荐答案
您必须使用Win32函数<一href="http://msdn.microsoft.com/en-us/library/windows/desktop/bb762159%28v=vs.85%29.aspx">Shell_NotifyIcon.您可以设置的的的 dwInfoFlags 的成员<一href="http://msdn.microsoft.com/en-us/library/windows/desktop/bb773352%28v=vs.85%29.aspx">NOTIFYICONDATA结构NIIF_USER为了使用自定义图标的气球提示。
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.
在Windows XP Service Pack 2和更高版本可以使用的惠康的成员来指定一个自定义图标。
On Windows XP Service Pack 2 and later you can use the hIcon member to specify a custom icon.
在Windows Vista和更高的NOTIFYICONDATA结构包含addiional成员的 hBalloonIcon 的。您可以使用该成员来指定一个自定义的图标,如果您已经设置了的 CBSIZE 的成员扩展NOTIFYICONDATA结构的正确尺寸。
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.
这篇关于如何创建丰富的工具提示和丰富的气球通知区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!