Hi,
You could use the code underneath and attach it to each form on which you want the existing ToolTips to be intercepted. Just be sure those ToolTips are part of the components container of this form.
Imports System.Windows.Forms
Public Class TooltipStopper
Inherits NativeWindow
Implements IDisposable
Dim TTs As Generic.List(Of ToolTip)
Public Sub New(Frm As Form)
'By use of reflection the ToolTipStopper will search for the "components" container on the form.
'This container should contain all the ToolTips created on the form.
Dim t As Type = Frm.GetType
Dim obj As Object = t.InvokeMember("components", Reflection.BindingFlags.GetField Or Reflection.BindingFlags.Instance Or Reflection.BindingFlags.NonPublic, Nothing, Frm, Nothing)
If Not obj Is Nothing Then
Dim components As System.ComponentModel.Container = CType(obj, System.ComponentModel.Container)
For i As Integer = 0 To components.Components.Count - 1
If TypeOf components.Components(i) Is ToolTip Then
'If a ToolTip has been found, add it to a collection.
Dim TT As ToolTip = CType(components.Components(i), ToolTip)
If TTs Is Nothing Then
TTs = New Generic.List(Of ToolTip)
End If
TTs.Add(TT)
'Defer the Popup event of the ToolTip to a procedure
AddHandler TT.Popup, AddressOf TT_Popup
End If
Next
End If
End Sub
Private Sub TT_Popup(sender As Object, e As PopupEventArgs)
'Show a replacement for the ToolTip here and cancel the original ToolTip
e.Cancel = True
End Sub
Public Sub Dispose() Implements IDisposable.Dispose
'Don't forget to remove the handlers for all the ToolTips found on the form
If Not TTs Is Nothing Then
For i As Integer = 0 To TTs.Count - 1
RemoveHandler TTs(i).Popup, AddressOf TT_Popup
Next
End If
End Sub
End Class
In the form you would then write something like this:
Public Class Form1
Dim ToolTipStop As TooltipStopper.TooltipStopper
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
'bind the ToolTipStopper to the form
ToolTipStop = New TooltipStopper.TooltipStopper(Me)
'set the tooltip(s) to the controls you want
Me.ToolTip1.SetToolTip(Me.Button1, "test")
End Sub
Private Sub Form1_Disposed(sender As Object, e As EventArgs) Handles Me.Disposed
'be sure to dispose the ToolTipStopper
Me.ToolTipStop.Dispose()
End Sub
End Class
Hope this helps!