ListbToolTip



Public WithEvents ListBox As ListBox
Private Sub ListBox_MouseMove(Button As Integer, Shift As Integer, X As Single, _
Y As Single)
Dim oldFont As StdFont, itemIndex As Long

' since a listbox doesn't have a TextHeight method

' we must borrow it from its Parent

With ListBox.Parent
Set oldFont = .Font
Set .Font = ListBox.Font
' determine which element the mouse is on

itemIndex = Y \ .TextHeight("A") + ListBox.TopIndex
' restore fonts

Set .Font = oldFont
End With

' set the tooltip to the current item's string

If itemIndex < ListBox.ListCount Then
ListBox.ToolTipText = ListBox.List(itemIndex)
Else
ListBox.ToolTipText = ""
End If
End Sub


(listbtooltip.html)- by Paolo Puglisi - Modifica del 25/3/2019