Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
Tooltip on UltraCombo

There have been many posts about tooltips disappearing while in an UltraCombo because of the internal text editor control in the UltraCombo.   Some suggest hooking the "control added" event to then add a tooltip to the editor control.    I believe I have a simpler solution.

Basically I create a "Rectangle" control with the same size and location as the UltraCombo.  Then, in the "MouseLeave" event of the UltraCombo I test to see if the mouse position is contained in this Rectangle, and, if it is, I don't turn off the tooltip.  If the mouse position is NOT in the rectangle, I turn off the tooltip.  Simple.  The only tricky part is realizing what is "screen coordinates" vs. "client coordinates" for the mouse position.

In my application, in the UltraCombo MouseEnter event, I see what the value is and create a customized tooltip based on that value.  In the MouseLeave event I just clear the tooltip.  Here is the sample MouseLeave event code:


Dim ComboRectangle As Rectangle

ComboRectangle.Size = MyCombo.Size

ComboRectangle.Location = MyCombo.Parent.PointToScreen(MyCombo.Location)   'MyCombo loc in screen coor

Dim MyMousePosition As Point = Cursor.Position  'cursor pos in screen coor

If ComboRectangle.Contains(MyMousePosition) Then

  Exit Sub

End If

tooltip3.GetUltraToolTip(MyCombo).ToolTipText = ""

This technique really works well for me, and hopefully others will find it useful as well.