ToolTipListB




Private Sub Form_Load()
'load a bunch of long messages in the listbox

For i = 0 To 25
List1.AddItem (i & ". This is a Long String that you can't _
see all of in the list box, it's #: " & i)
Next i
End Sub
'_________________________________________________________


Private Sub List1_MouseMove(Button As Integer, Shift As Integer, _
X As Single, Y As Single)
'the height of the default text (you will have to change this

'if you change the font size)

WordHeight = 195
'go through the loop until you get to the file

For i = 0 To List1.ListCount - 1
'check to what line the text is over (you need to go

'through the whole list in case you've scrolled down

If Y > WordHeight * (i - List1.TopIndex) _
And Y < (WordHeight * i + WordHeight) Then
'set the tooltiptext to the list box value

List1.ToolTipText = List1.List(i)
'see if your in "empty space"

ElseIf Y > (WordHeight * i + WordHeight) Then
List1.ToolTipText = "Empty space"
End If
Next i
End Sub

Assumes:
Just place a list box on a form (less than 25 lines to see the
scrolling ability. More than 25 to see empty space handling)

Side Effects:
On slow PC's with alot of stuff running the tipbox will appear to flash :(












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