News:

Build a stunning handcrafted website with IT Acumens

Main Menu

ListBox item under the mouse

Started by nandagopal, May 20, 2009, 07:15 PM

Previous topic - Next topic

nandagopal

Use GetCursorPos to get the mouse position. Use LBItemFromPt to get the item at that position.


Private Sub Form_MouseMove(Button As Integer, Shift As _
    Integer, X As Single, Y As Single)
    'should provide list autodragging
    Dim ret, cp As POINTAPI
    GetCursorPos cp
    ret = LBItemFromPt(List1.hwnd, cp.X, cp.Y, True)
    Form1.Caption = ret & ":" & X & ":" & Y
    List1.ListIndex = ret
End Sub

Private Sub List1_MouseMove(Button As Integer, Shift As _
    Integer, X As Single, Y As Single)
    Dim ret, cp As POINTAPI
    GetCursorPos cp
    ret = LBItemFromPt(List1.hwnd, cp.X, cp.Y, True)
    Form1.Caption = ret & ":" & X & ":" & Y
    List1.ListIndex = ret
End Sub



dhoni

yes its really easy to listbox should item under the mouse
it can easilyuse in vb.net
it mainily use for many program