Code:' 'had to make a fix on this works now ' Option Explicit 'using a tooltip for the list items in a listbox 'with a mouse move event. 'Here's the mouse move event for your listbox "List1" : Private Sub Form_Load() Dim x As Integer For x = 1 To 10 List1.AddItem "Hello " & x & " Times" Next x End Sub Private Sub List1_MouseMove _ (Button As Integer, Shift As Integer, _ x As Single, Y As Single) Dim cv, tps, bs, ts, r, wr, rn, num 'whats the twips/point conversion? cv = 20 '20 twips = 1 point 'how many twips are added to the 'font size to make up a row? tps = 30 'whats the border size of the list in twips? bs = 40 'see if mouse pointer is on the list box If x > 10 And x < List1.Width - 80 Then If Y > 10 And Y < List1.Height - 80 Then 'whats the twip size of every row? ts = List1.FontSize * cv + tps 'how many rows does the list display? r = (List1.Height - bs) / ts 'what's the exact width of every row? wr = List1.Height / r 'what row number from the top is the mouse over? rn = Int(Y / wr) 'what list item number is that? num = List1.TopIndex + rn 'display tool tip text List1.ToolTipText = List1.List(num) End If End If End Sub
[Edited by HeSaidJoe on 09-09-2000 at 11:28 PM]




Reply With Quote