iA piece of internet history. AllAPI.net was made by two Belgian brothers, still in their teens, from 1998 to 2002, and at its peak 180,000 programmers a month came here. We keep it online exactly as it was. Nothing here is maintained anymore.
AllAPI Network - The KPD-Team

 
Allapi Network
 API-Guide
 ApiViewer

 API List

 
API Resources
 Tips & Tricks
 VB Tutorials
 
Misc Stuff
 VB examples
 VB Tools
 VB Links
 Top Downloads
 


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.

 

 


Copyright © 1998-2007, The Mentalis.org Team - Privacy statement
This site is located at http://allapi.mentalis.org/