ViewTipLW




Private Declare Function SendMessage Lib _
"user32" Alias "SendMessageA" (ByVal hwnd _
As Long, ByVal wMsg As Long, ByVal wParam _
As Long, lParam As Any) As Long
Private Const LB_ITEMFROMPOINT = &H1A9
Private Sub Form_Load()
With List1
.AddItem "Accedi"
.AddItem "www.vb-tips.com"
.AddItem "http://vbT32.cjb.net"
End With
End Sub

Private Sub List1_MouseMove(Button _
As Integer, Shift As Integer, X As _
Single, Y As Single)
Dim lXPoint As Long
Dim lYPoint As Long
Dim lIndex As Long
If Button = 0 Then ' nessun bottone premuto
lXPoint = CLng(X / Screen.TwipsPerPixelX)
lYPoint = CLng(Y / Screen.TwipsPerPixelY)
With List1
' legge l'item selezionato dalla listbox

lIndex = SendMessage(.hwnd, _
LB_ITEMFROMPOINT, 0, ByVal _
((lYPoint * 65536) + lXPoint))
' visualizza la tip o la cancella

If (lIndex >= 0) And _
(lIndex <= .ListCount) Then
.ToolTipText = .List(lIndex)
Text1.Text = .List(lIndex)
Else
.ToolTipText = ""
End If
End With
End If
End Sub

Aggiungere una listbox ed una textbox su un form.











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