|
-
Sep 9th, 2000, 10:22 PM
#1
Thread Starter
Addicted Member
Hiyas,
How can I make it so when I have the mouse over a listbox's item, the tooltip text displays that item's text?
Thanks.
-Git
-
Sep 9th, 2000, 10:24 PM
#2
_______
<?>
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]
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Sep 9th, 2000, 10:39 PM
#3
Thread Starter
Addicted Member
Hi,
Cool, works perfectly. =))
Is there anyway to change the colour of the tool tip text/background?
Thanks,
-Git
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|