Jesse Williams
Jesse Williams

Reputation: 662

Using CTRL + MouseOver to Display a Tooltip

So I have tooltips on a variety of checkboxes and sliders in my application. This is partially necessary because the app is intended to be used by specific people at my company to create files (a large number of proprietary file formats, each with a variety of options). I decided at one point that tooltips were a good stopgap measure until there's a full set of documentation, plus it makes it easier on the fly to see what is out there.

I've considered using a global configuration checkbox that would enable or disable tooltips, but I was wondering if there was an elegant way to only display tooltips on mouseover while CTRL was being held down. I couldn't readily find anything on this. Any comments are appreciated.

Edit: The reason being that having tooltips pop up all the time as you move through the interface isn't really ideal, but being able to quickly access tooltips is very helpful.

Also, can someone please explain why this kind of question gets down-voted? It's frustrating to come here and see questions like "What is .NET" remain positive, and questions where I'm trying to learn something specific that isn't readily available on the Internet-at-large gets down-voted.

Here are all of the locations where the tooltip tipFRBx9P446 exists in my actual code.

Form1.Designer.cs:

        this.tipFRBx9P446 = new System.Windows.Forms.ToolTip(this.components);
        this.tipFRBx9P446.SetToolTip(this.cbFRBx9P446, "This will force P44 fields to reflect a value of \'6\'.  This can be used to ensure" + " proper testing of TFS WI 75062.");
        // 
        // tipFRBx9P446
        // 
        this.tipFRBx9P446.UseAnimation = false;
        this.tipFRBx9P446.UseFading = false;
        //
        private System.Windows.Forms.ToolTip tipFRBx9P446;

Form1.resx:

        <metadata name="tipFRBx9P446.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>762, 17</value>

Upvotes: 0

Views: 148

Answers (1)

joko
joko

Reputation: 182

You can use the Control.Modifier Key to check if CRTL is pressed:

if (Control.ModifierKeys == Keys.Control)
    {
       //CRTL is being pressed, show tooltip
    }

You should be able to use this code in your "Mouse_Hover"-event of the respective checkboxes. Hope this will help!

Upvotes: 1

Related Questions