如何在LISTBOX中移动鼠标就可以起到CLICK的作用
1个回答
展开全部
下面用两种方法分别一试:方法1�0�2 Sendmessage 向LISTBOX发送消息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()
Dim i As Byte
For i = 1 To 20
List1.AddItem String(i, Chr(i + 64))NextEnd SubPrivate Sub List1_Click() '随时看到效果
Me.Caption = "The listitem you select is """ & List1.Text & """"
End SubPrivate Sub List1_Mousemove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim lX As Long, lY As Long, lIndex As Long
�0�2�0�2�0�2�0�2�0�2�0�2�0�2 lX = CLng(X / Screen.TwipsPerPixelX)
�0�2�0�2�0�2�0�2�0�2�0�2�0�2 lY = CLng(Y / Screen.TwipsPerPixelY)
�0�2�0�2�0�2�0�2�0�2�0�2�0�2 lIndex = SendMessage(List1.hwnd, LB_ITEMFROMPOINT, 0, ByVal ((lY * &H10000) + lX))
If lIndex >= 0 And lIndex
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询