C# - 删除仅提供 Control 是工具提示的工具提示 [英] C# - Remove ToolTip only supplying in which Control is the ToolTip

查看:31
本文介绍了C# - 删除仅提供 Control 是工具提示的工具提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是的,这个问题已经被问过了在这里在SO.

Yes this question as already been asked here at SO.

问题是那个问题的解决方案是隐藏工具提示,我真的需要删除而不是隐藏它.

The problem is that the solution for that question was hiding the tooltip, and i really need to remove not hide it.

我正在使用我创建的几个函数向表单中的多个控件添加工具提示.

I'm adding tooltips to several controls in my Form using a couple a functions i've made.

有两个功能,一个是设置工具提示在鼠标悬停时显示,另一个是始终显示工具提示.

There are two functions, one to set the Tooltip to display on MouseHover, and another to show the Tooltip at all times.

只缺一个.一种用于删除特定控件已设置或正在显示的任何工具提示.

Only one missing. One to remove any Tooltip that is been set or is being displayed by a specific control.

类似的东西

tooltip.remove(TextBox1);

这么简单的事情,我只需要在工具提示所在的位置设置控件.

Something that simple where i only need to set the Control where the tooltip is.

我尝试了几件事,但没有奏效.

I've tried a couple things but didn't work.

谢谢.

这就是我使用我的代码添加工具提示的方式.

This is how i use my code to add tooltips.

这是错误的编码方式

我设置和显示工具提示的代码:

public class UserInterface
{
    public void SetTooltip(Control Object, string Message, string Title, ToolTipIcon icon, Boolean isBallon, Boolean showAlways)
    {
        ToolTip Tip = new ToolTip();
        Tip.UseAnimation = true;
        Tip.UseFading = true;
        Tip.ToolTipIcon = icon;
        Tip.IsBalloon = isBallon;
        Tip.ShowAlways = showAlways;
        Tip.ToolTipTitle = Title;
        Tip.SetToolTip(Object, Message);
    }

    public void ShowTooltip(Control Object, string Message, string Title, ToolTipIcon icon, Boolean isBallon, Boolean showAlways)
    {
        ToolTip Tip = new ToolTip();
        Tip.UseAnimation = true;
        Tip.UseFading = true;
        Tip.ToolTipIcon = icon;
        Tip.IsBalloon = isBallon;
        Tip.ShowAlways = showAlways;
        Tip.ToolTipTitle = Title;
        Tip.Show(Message, Object);
    }
}

推荐答案

应该这样做:

ToolTip.SetToolTip(TextBox1, null);

这篇关于C# - 删除仅提供 Control 是工具提示的工具提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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