如何使用System.Windows.Forms.ToolTip作为带关闭按钮的Balloon工具提示? [英] How to use System.Windows.Forms.ToolTip as Balloon tooltip with close button?

查看:134
本文介绍了如何使用System.Windows.Forms.ToolTip作为带关闭按钮的Balloon工具提示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

专家:

1)如何使用System.Windows.Forms.ToolTip作为带关闭按钮的Balloon工具提示.不想使用API​​显示关闭按钮.

2)当用户单击关闭按钮时,该气球始终显示并关闭.

3)当用户单击关闭按钮时,仅关闭该气球而不是其他气球.

Experts:

1) How to use System.Windows.Forms.ToolTip as a Balloon tooltip with close button. Don''t want to use API to show the close button.

2) That balloon is always showing and close when the user clicks on the close button.

3) When the user clicks on the close button only close that balloon alone not other balloons.

推荐答案

如果您不想进入复杂的API调用,那么我认为您将无法使用标准的WinForms ToolTip控件.

但是我建议您看一下有关CP的这篇文章:Noor Abuhamdeh撰写的"Balloon ToolTip Control" [
使Form或UserControl具有一些自定义形状很容易(通过设置Region属性),精确地计算如何绘制自定义形状,以使其具有该箭头或将其连接到您希望它出现的位置的方式...时间出现...将不会那么容易.这是我个人不会承担的任务.

您已经给我一个可以使用透明表格进行测试的想法,如果测试结果令人满意,我将在此回复中添加一份报告.

仅供参考:在VS 2010 Studio Pro中,现在在WinForms项目中针对FrameWork 4.0进行编译:我有一个工具提示,其"IsBalloon"属性设置为"true":在使用该控件的控件上根本没有出现...将该属性设置为"true :)",我对此进行了测试,向后回归以针对所有版本为3.0的FrameWork版本进行编译:结果相同.也许我不是值得的气球" :)

Bill,祝你好运
If you do not want to get into complex API calls, then I do not think you will be able to use the standard WinForms ToolTip Control.

But I suggest you take a look at this article on CP: "Balloon ToolTip Control," by Noor Abuhamdeh[^], before you reject the idea of using an solution that uses API.

And, as this Sept. 2011 thread on MS might show you: there can be real problems using the current ToolTip WinForms Control in ''Balloon" mode:[^].

If you are willing to use a Form or UserControl, instead, then you have a lot of options: you can use partial transparency for example. Using a Form, you can set the Form used-as-ToolTip ''Owner property to the Form that uses it, which will be very useful as it guarantees the desired Z-order relationship with its ''Owner.

The question you must then answer, if you use a UserControl or Form is: how important is it to have that little connecting arrow from the "balloon" to the place you want it to connect to ? How important is it that that the UserControl, or Form, used as ToolTip, have a custom shape ... like a Balloon ?

While making a Form or UserControl have some custom shape is easy (by setting the Region property), calculating exactly how to draw the custom shape so that it has that arrow or whatever connecting it to the place you want it to appear ... every time it appears ... will not be so easy. It''s a task I would not personally take on.

You have given me an idea to test involving use of a transparent Form here, and if the test gives any satisfactory result, I will add a report on that to this response.

fyi: in VS 2010 Studio Pro, compiling against FrameWork 4.0, in a WinForms project, right now: I have a ToolTip with its ''IsBalloon property set to ''true: it does not appear, on Controls that use it, at all ... with that property set to ''true :) I''ve tested this, regressing backwards to compile against all FrameWork versions back to 3.0: same results. Perhaps I am not "balloon worthy" :)

good luck, Bill


这篇关于如何使用System.Windows.Forms.ToolTip作为带关闭按钮的Balloon工具提示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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