目前,我正在添加工具提示标签,像这样:
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?
创建工具提示的单个实例
并使用它,只要你喜欢它使用 SetToolTip 方法和使用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.