vb中listview如何让上面item不能呗鼠标拖动

2025-01-06 02:49:56
推荐回答(1个)
回答1:

Private Declare Function ReleaseCapture Lib "user32" () As Long

Private Sub Form_Load()
With ListView1
.ListItems.Add , , "Item1"
.ListItems.Add , , "Item2"
.ListItems.Add , , "Item3"
End With
End Sub

Private Sub ListView1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = 1 Then
ReleaseCapture
End If
End Sub