Jump to content

Dismiss ToolTip Window?


Recommended Posts

Is there a way to make the tool tip window go away once the Comb Box has been opened?

 

1-screenshot.jpg

 

 

A reusable method like sketched out below could handle each Combo Box's DropDown and DropDownClosed event:

    private ComboBox ComboBox1, ComboBox2, ComboBox3;
    private const String CBO1_TOOLTIP = "Shape type\nClick to open list\nShortcut keys: A (next shape), Shift+A (previous shape)";
    private const String CBO2_TOOLTIP = "Text for ComboBox2";
    private const String CBO3_TOOLTIP = "Text for ComboBox3";

    private void InitializeComponent_Example()
    {
        // ComboBox1:
        ComboBox1.DropDown += new EventHandler(DropDown_Dropping);
        ComboBox1.DropDownClosed += new EventHandler(DropDown_Close);
        ComboBox1.Tag = CBO1_TOOLTIP;
        toolTip1.SetToolTip(ComboBox1, CBO1_TOOLTIP);
        // ComboBox2:
        ComboBox2.DropDown += new EventHandler(DropDown_Dropping);
        ComboBox2.DropDownClosed += new EventHandler(DropDown_Close);
        ComboBox2.Tag = CBO2_TOOLTIP;
        toolTip1.SetToolTip(ComboBox2, CBO2_TOOLTIP);
        // ComboBox3:
        ComboBox3.DropDown += new EventHandler(DropDown_Dropping);
        ComboBox3.DropDownClosed += new EventHandler(DropDown_Close);
        ComboBox3.Tag = CBO3_TOOLTIP;
        toolTip1.SetToolTip(ComboBox3, CBO3_TOOLTIP);
    }

    private void DropDown_Close(object sender, EventArgs e)
    {
        var ctrl = sender as ComboBox;
        if (ctrl != null)
        {
            toolTip1.SetToolTip(ctrl, String.Format("{0}", ctrl.Tag));
        }
    }

    private void DropDown_Dropping(object sender, EventArgs e)
    {
        var ctrl = sender as ComboBox;
        if (ctrl != null)
        {
            toolTip1.SetToolTip(ctrl, null);
        }
    }

If this is worth doing, my hope is that providing the code is helpful.

 

I don't know if this is still a .NET project or what language it is currently in.

post-48278-0-22928500-1429801111_thumb.j

~Joe

Avoid Sears Home Improvement (click to read why)

Link to comment
Share on other sites

You could just move your mouse off the button. The tooltip goes away almost immediately.

No, Paint.NET is not spyware...but, installing it is an IQ test. ~BoltBait

Blend modes are like the filling in your sandwich. It's the filling that can change your experience of the sandwich. ~Ego Eram Reputo

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...