I have written an Extension Method to be able to add tooltips to let's say any checkbox in my application if desired :
<Extension()> _ Public Sub SetToolTip(ByVal control As JdnCheckBox, ByVal tooltipText As String, title As String) AddToolTip(control, tooltipText, title) End Sub
Private Sub AddToolTip(ByVal control As System.Windows.Forms.Control, ByVal tooltipText As String, title As String) If control IsNot Nothing Then Using tooltipInfo As New UltraToolTipInfo() tooltipInfo.ToolTipText = tooltipText tooltipInfo.ToolTipTitle = title Dim tooltipManager As New Infragistics.Win.UltraWinToolTip.UltraToolTipManager tooltipManager.DisplayStyle = Infragistics.Win.ToolTipDisplayStyle.Office2007 tooltipManager.InitialDelay = 200 tooltipManager.AutoPopDelay = 0 tooltipManager.Appearance.BorderColor = Color.FromArgb(255, 255, 211, 89) tooltipManager.SetUltraToolTip(control, tooltipInfo) End Using End If End Sub
This works fine to add tooltips to my desired checkboxes, BUT now I need the same to remove a tooltip from a checkbox, of which I don't know it has one on it. I was looking for something like
tooltipManager.RemoveUltraToolTip(control) but I cannot find such thing...
How can I solve this.
Hello timdelma,
I wanted to know if you were able to solve your issue based on these suggestions or you still need help. Please let me know.
Hi,
timdelma said:Just tried it but no solution. I must mention that I always use a new instance of the UltraToolTipManager. Could this be the problem ?
Yes, that is certainly a problem. You have to remove the tooltip from the tooltipManager to which it was added.
Why use a new ToolTipManager each time? That's terribly inefficient. You are using up a lot of memory unnecessarily. Also, the tooltips may not interact properly with each other - you could end up having two tooltips displayed at the same time, since they are managed by two different managers that don't know about each other.
Just tried it but no solution. I must mention that I always use a new instance of the UltraToolTipManager. Could this be the problem ?
Because it's an extension method I cannot use a fixed instance of the ToolTipManager...
This is the new Extension Method :
<Extension()> _ Public Sub RemoveToolTip(ByVal control As JdnCheckBox) If control IsNot Nothing Then Dim tooltipManager As New Infragistics.Win.UltraWinToolTip.UltraToolTipManager tooltipManager.DisplayStyle = Infragistics.Win.ToolTipDisplayStyle.Office2007 tooltipManager.InitialDelay = 200 tooltipManager.AutoPopDelay = 0 tooltipManager.Appearance.BorderColor = Color.FromArgb(255, 255, 211, 89) tooltipManager.SetUltraToolTip(control, Nothing) End If End Sub
Just set it to null:
tooltipManager.SetUltraToolTip(control, null)