这个没有直接的办法达到,你可以这样,在鼠标的mousedown事件中判断所在位置然后与listview中的最后一行的top and height比较,然后再自己决定.
简单!!! Private Sub mList_MouseUp(Button As Integer, Shift As Integer, X As Single, y As Single) Dim mlvRip As MSComctlLib.ListItem With mList Set mlvRip = .HitTest(X, y) If mlvRip Is Nothing Then For i = 1 To .ListItems.Count .ListItems(i).Selected = False Next i If Button = 2 Then mAb.Bands("bpFileNoSel").PopupMenu Else If Button = 2 Then mAb.Bands("bpFileSel").PopupMenu End If End With End Sub
Private Sub mList_MouseUp(Button As Integer, Shift As Integer, X As Single, y As Single)
Dim mlvRip As MSComctlLib.ListItem
With mList
Set mlvRip = .HitTest(X, y)
If mlvRip Is Nothing Then
For i = 1 To .ListItems.Count
.ListItems(i).Selected = False
Next i
If Button = 2 Then mAb.Bands("bpFileNoSel").PopupMenu
Else
If Button = 2 Then mAb.Bands("bpFileSel").PopupMenu
End If
End With
End Sub