Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
 
 
 
 
 
 
 
Old Pages
 
Old Index
Site Map
What's New
 
Books
How To
Tips & Tricks
Tutorials
Stories
Performance
Essays
Links
Q & A
New in VB6
Free Stuff
Pictures
 
 
 
TitleTrack the ListBox item under the mouse
KeywordsListBox, mouse, over
CategoriesControls, API
 
Thanks to Sergio Perciballi.

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
 
 
Copyright © 1997-2003 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated