vb鼠标拖动事件代码

来源:百度知道 编辑:UC知道 时间:2024/05/17 08:43:52
在VB中,如何编写按下鼠标左键将FileListBox中相应的文件拖到list中的代码
图片说明:
http://www.ishare.com.cn/d/1743130-1/image001.png
问题补充:希望能提供代码,谢谢
Option Explicit
Private Sub Form_Load()
Dim i As Integer
For i = 0 To 24
List1.AddItem i
List2.AddItem i + 25
Next
List1.DragMode = 0
End Sub

Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
List1.Drag 1
End Sub

Private Sub List2_DragDrop(Source As Control, X As Single, Y As Single)
If Source = List1 Then
List2.AddItem List1.List(List1.ListIndex)
List1.RemoveItem List1.ListIndex
End If
End Sub

http://topic.csdn.net/t/20021224/09/1293932.html
这里有两种实现方法可供参考.第一种是使用button来移动,第二种是拖动,但效果不太好.