# Re: 如何拖曳ListBox里的选项上下移动呢?

Posted by 哥尧 on September 08, 1998 at 09:45:44:

In Reply to: 如何拖曳ListBox里的选项上下移动呢? posted by Jessie on September 07, 1998 at 18:30:11:

回答问题一:
一般区
Dim inddown As Integer
Dim mstr As String
Dim indup As Integer

Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
inddown = List1.ListIndex '记下按下mouse时 list1.listindex
mstr = List1.List(inddown) '记下按下mouse时 list1.list
End Sub

Private Sub List1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
indup = List1.ListIndex '记下放开mouse时 list1.listindex
If indup <> -1 Then '若在无资料处放开mouse则不作以下动作(会bug)
List1.RemoveItem inddown '把MouseDown时记下的list1.list 移除
List1.AddItem mstr, indup '把MouseDown时记下的list1.list 加至MouseUp处
End If
End Sub

Follow Ups: