Search code examples
c#winformsuser-controlsstatusbar

ToolTip does not show in Status bar addin


I am developing a status bar Add-in for a business program. The add-in returns a usercontrol that is placed on the statusbar by the program. In that User Control I have a small icon in a picturebox. I want to show a tooltip when the user hovers over the icon. I have the following code:

ToolTip Message = new ToolTip();
Message .ShowAlways = true;
Message.SetToolTip(MyIcon);

The Tooltip does not show up however. This is probably due to the StatusStrip.ShowItemToolTips set to false. I cannot change this however since that is part of the program.

Is there any way to force the tooltips to show, or can I inherit a custom class from the ToolTip class and have it show up? I do not want to create a complete new class for something that is already there.


Solution

  • As per Hans Passant's Suggestion I ended up with the following;

    ToolTip Message = new ToolTip();
    MyIcon.MouseHover += ShowToolTip;
    
    private void ShowToolTip(object sender, EventArgs e)
        {
            Message.Show("Bladiebla",MyIcon);
        }