LISTBOX E CURSOR
Existe alguma maneira de exibir o item da ListBox que está embaixo do cursor ??
'se o Evento MauseMove do list:
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 As Long = &H1A9
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
lXPoint = CLng(X / Screen.TwipsPerPixelX)
lYPoint = CLng(Y / Screen.TwipsPerPixelY)
lIndex = SendMessage(List1.hwnd, LB_ITEMFROMPOINT, 0, ByVal ((lYPoint * 65536) + lXPoint))
If (lIndex >= 0) And (lIndex <= List1.ListCount) Then
List1.ToolTipText = List1.List(lIndex)
Text1.Text = List1.List(lIndex)
Else
List1.ToolTipText = ""
End If
End If
End Sub
Espero ter ajudado...
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 As Long = &H1A9
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
lXPoint = CLng(X / Screen.TwipsPerPixelX)
lYPoint = CLng(Y / Screen.TwipsPerPixelY)
lIndex = SendMessage(List1.hwnd, LB_ITEMFROMPOINT, 0, ByVal ((lYPoint * 65536) + lXPoint))
If (lIndex >= 0) And (lIndex <= List1.ListCount) Then
List1.ToolTipText = List1.List(lIndex)
Text1.Text = List1.List(lIndex)
Else
List1.ToolTipText = ""
End If
End If
End Sub
Espero ter ajudado...
Tópico encerrado , respostas não são mais permitidas