如何在Delphi中显示Vista风格的气球提示? [英] How to show Vista style balloon hints in Delphi?

查看:295
本文介绍了如何在Delphi中显示Vista风格的气球提示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在输入验证时,我使用气球提示而不是消息框。
我的问题是,在Vista上,它们具有旧的XP风格,圆角,而不是更新的更像矩形的外观。

On input validation, I'm using balloon tips instead of message boxes. My problem is that on Vista, they have the old XP style with the rounded corners, not the newer more rectangle like appearance.

我已经尝试创建他们使用CreateWindowEx和 tooltips_class32 或使用SendMessageW和 EM_SHOWBALLOONTIP 显示编辑的相关联的balloontip,结果是一样的。
在Visual Studio和C#中执行相同的操作会导致Vista风格的气球提示。

I've tried creating them using CreateWindowEx and tooltips_class32 or showing the Edit's associated balloontip using SendMessageW and EM_SHOWBALLOONTIP, the result is the same. Doing the same thing in Visual Studio and C# results in a Vista style balloon tip.

您可以看到我需要的气球提示的示例,当您在密码编辑中切换Caps Lock,就像Windows登录一样。

You can see an example of the balloon hint I need, when you toggle Caps Lock while in a password edit, like the one on the Windows Logon.

推荐答案

如果您使用Delphi 2009,然后添加气球提示是相当简单的,尽管文档很差。 (惊喜,惊喜)

If you're using Delphi 2009, then adding balloon hints is reasonably straightforward, although the documentation is poor. (surprise, surprise)


  • 在您的表单上删除TBalloonHint

  • 删除TImageList以包含图标如果需要,

  • 将TIMageList链接到TBalloonHint

  • 将表单的CustomHint属性设置为TBalloonHint

  • 确保ShowHint和ParentCustomHint为您的控件设置为true。

  • Drop a TBalloonHint on your form
  • Drop a TImageList to contain icons if needed.
  • Link the TIMageList to the TBalloonHint
  • Set the form's CustomHint property to the TBalloonHint
  • Make sure ShowHint and ParentCustomHint are set true for your controls.

下一个位是非常不明显


  • 将控件的提示属性格式化为标题|提示| ImageIndex

您已经完成了。这看起来不像100%vista一样,也许是因为字体选择。但是很接近。

You're done. This doesn't look 100% vista-like, maybe due to font choice. But it's pretty close.

Delphi 2009 http://dn.codegear.com/article/images/38757/0300000D.png

这篇关于如何在Delphi中显示Vista风格的气球提示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆