ListBox有DragDrop事件和OLEDragDrop事件,这应该能实现你所需要的功能。我没时间给你试,你自己看看,提醒一句,注意设置DragMode和OLEDragMode属性等,这对DragDrop和OLEDragDrop事件的触发有影响

解决方案 »

  1.   

    我如果设置listbox的dragmode为自动的化,那么它就不响应click事件了,我也就没办法选择其中的某一条目了。这是我的问题所在。
      

  2.   

    这个东西太简单了我随意用了两个Combo控件、两个Command控件来代表拖动
    如:Combo1中用五个值A1,A2,A3,A4,A5,Combo2中用五个值B1,B2,B3,B4,B5
    Command1代表Combo1到Combo2Private Sub Command1_Click()
        If Me.Combo1.ListCount = 0 Then Exit Sub
        Me.Combo2.AddItem (Me.Combo1.List(Me.Combo1.ListIndex))
        Me.Combo1.RemoveItem (Me.Combo1.ListIndex)
    End SubPrivate Sub Command2_Click()
        If Me.Combo2.ListCount = 0 Then Exit Sub
        Me.Combo1.AddItem (Me.Combo2.List(Me.Combo2.ListIndex))
        Me.Combo2.RemoveItem (Me.Combo2.ListIndex)
    End Sub试试,若有问题,跟我联系[email protected]
      

  3.   

    list1拖放到list2的例子。反之同理。
    Option ExplicitPrivate 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 SubPrivate 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
      

  4.   

    非常感谢楼上的兄弟,你提供的方法非常好,但是有一个小的问题请教,就是:在拖动list1里面的条目的时候,感觉整个list1在拖动,效果上给人一种错觉,能否给用户一种只是在拖动这个条目的感觉,就是说,将拖动时的图标改为listbox中的条目呢?非常感谢!