用API应该很简单,不过我只会用BCB写。

解决方案 »

  1.   

    LISTBOX是不行的,用TREEVIEW吧,或者自已去找个控件
      

  2.   

    Option ExplicitPrivate Const LB_ITEMFROMPOINT = &H1A9
    private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As LongPrivate Sub List1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        Dim pos As Long, idx As Long
        
        pos = X / Screen.TwipsPerPixelX + Y / Screen.TwipsPerPixelY * 65536
        idx = SendMessage(List1.hwnd, LB_ITEMFROMPOINT, 0, ByVal pos)
        
        If idx < 65536 Then  list1.selected(idx)=true
    End Sub