ModToolTip




'Author Marco Piras : mmark@tiscalinet.it

'Insert in the general declarations of the Form

'API Declares for Enable/Disable the Default Tooltip of TreeView

Option Explicit
Private Declare Function SetWindowLong Lib "user32" _
Alias "SetWindowLongA" (ByVal hWnd As Long, _
ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong Lib "user32" _
Alias "GetWindowLongA" (ByVal hWnd As Long, _
ByVal nIndex As Long) As Long
Const TVS_NOTOOLTIPS = &H80
Const GWL_STYLE = (-16)
'/// end of Declares

Private modTooltip As Boolean ' Enable / Disable personal Tooltip
'----------------------------------------------------------------

' Sub to Change Tooltip of Default

' Here the new coordinates of the mouse are inserted

'

Private Sub SetToolTip(ByVal movX As Single, ByVal movY As Single)
'

' Set the New Object Node

'

Dim newNodeTip As Node
'

' News coordinates x,y

'

Set newNodeTip = tv1.HitTest(movX, movY)
'

' Assign new Tooltip

'

tv1.ToolTipText = newNodeTip.Text ' or Other Text

Label1.Caption = newNodeTip.Text

End Sub

'To apply the personalized Tooltip to disable the Tooltip of default,

'es.Apply the code in the Command1_click event

SetWindowLong tv1.hWnd, GWL_STYLE, _
GetWindowLong(tv1.hWnd, GWL_STYLE) Or TVS_NOTOOLTIPS
modToolTip = true
'and aply this code in the Treeviev_mouseMove event

if modTooltip then SetToolTip x, y
'This is All and it is really very simple











( modtooltip.html )- by Paolo Puglisi - Modifica del 17/12/2023