如何删除当前绑定到一个控制工具提示? [英] How do I remove a tooltip currently bound to a control?

查看:127
本文介绍了如何删除当前绑定到一个控制工具提示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我正在添加工具提示标签,像这样:

I'm currently adding a tooltip to a label like so:

ToolTip LabelToolTip = new System.Windows.Forms.ToolTip();
LabelToolTip.SetToolTip(this.LocationLabel, text);

当我需要更改此提示为标签的文本改变,我尝试做同样添加一个新的工具提示。不幸的是,旧的提示仍然在新的一个,这实在是烦人。有没有一种方法来删除旧的提示,或者我应该只是做一个新的标签时,我想改变文本标签?

When I need to change this tooltip as the label's text changes, I try doing the same to add a new tooltip. Unfortunately, the old tooltip remains under the new one, which is really annoying. Is there a method to remove the old tooltip, or should I just make a new label when I want to change the text in a label?

推荐答案

创建工具提示的单个实例并使用它,只要你喜欢它使用<$显示C $ C> SetToolTip 方法和使用<一个href="http://msdn.microsoft.com/en-us/library/system.windows.forms.tooltip.hide.aspx"><$c$c>Hide方法来隐藏它。一般来说,没有必要创建一个以上的工具提示实例。

Create a single instance of the ToolTip and use it whenever you like to show it using the SetToolTip method and use Hide method to hide it. Generally it is not necessary to create more than one ToolTip instance.

这篇关于如何删除当前绑定到一个控制工具提示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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