65.9K
CodeProject is changing. Read more.
Home

ToolStrip with Custom ToolTip

starIconstarIconstarIconstarIconstarIcon

5.00/5 (7 votes)

May 1, 2012

CPOL

1 min read

viewsIcon

51908

downloadIcon

2024

Custom WinForm ToolStrip that fixes some of the ToolTip related problems and adds few related features

Introduction

Stock .NET ToolStrip control has several annoying bugs considering its tooltip:

  • Tooltip is not hidden on click - click is behavior that indicates that user has understood what item is about, so user expects tooltip to be hidden, and the second problem is that click might result in change of tooltip text, so shown tooltip might become irrelevant.
  • Tooltip doesn't care if dropdown is shown - it looks very ugly if item's dropdown is shown over its tooltip, or tooltip over its dropdown.

Also, several tooltip related features are added.

Using the Code

Using ToolStripToolTip is as simple as:

ToolStipToolTip toolStrip1 = new ToolStripToolTip();

Also, you may want to use some of the following properties or objects:

  • Tooltip - I have decided to make Tooltip exposed, as you might sometimes want to hide it on some custom event.
  • ToolTipInterval - integer for interval in ms in which tooltip stays visible. By default, it is 4000.
  • ToolTipText - string for text for tooltip that will be shown for ToolStrip (when mouse is over it, but not over any particular item).
  • ToolTipShowUp - if True, tooltip is shown above the pointer, which is useful if ToolStrip is docked to bottom of Form. By default it is false.

History

  • 2012/05/01 - First version