Setting the ToolTipText on a ListBox
If the width of a ListBox control is too small to show the content I have found it
practical to set the ToolTipText property to reflect on the item the mouse is hovering
over.
Code Private Sub
List1_MouseMove(Button As _
Integer, Shift As Integer, X As Single, Y As Single) Dim YPos As
Integer, iOldFontSize As Integer
iOldFontSize = Me.Font.Size
Me.Font.Size = List1.Font.Size
YPos = Y \ Me.TextHeight("Xyz") + List1.TopIndex
Me.Font.Size = iOldFontSize
If YPos < List1.ListCount Then
List1.ToolTipText = List1.List(YPos)
Else
List1.ToolTipText = ""
End If
End Sub
I found
this to be more practical than using Windows API to get the
horizontal
scrollbar.
|