1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
Private Sub ListBox1_MouseMove( _
ByVal Button As Integer, _
ByVal Shift As Integer, _
ByVal X As Single, _
ByVal Y As Single)
Dim Obj As DataObject
Dim Action As Integer
If Me.ListBox1 = "" Then Exit Sub
If Button = 1 Then
Set Obj = New DataObject
With ListBox1
Obj.SetText .Column(0, .ListIndex) _
& "*" & .Column(1, .ListIndex)
End With
Action = Obj.StartDrag
End If
Set Obj = Nothing
End Sub
Private Sub ListBox2_BeforeDragOver( _
ByVal Cancel As MSForms.ReturnBoolean, _
ByVal Data As MSForms.DataObject, _
ByVal X As Single, _
ByVal Y As Single, _
ByVal DragState As MSForms.fmDragState, _
ByVal Effect As MSForms.ReturnEffect, _
ByVal Shift As Integer)
Cancel = True
Effect = 2
End Sub
Private Sub ListBox2_BeforeDropOrPaste( _
ByVal Cancel As MSForms.ReturnBoolean, _
ByVal Action As MSForms.fmAction, _
ByVal Data As MSForms.DataObject, _
ByVal X As Single, _
ByVal Y As Single, _
ByVal Effect As MSForms.ReturnEffect, _
ByVal Shift As Integer)
Dim Pos As Integer
Cancel = True
Effect = 2
Pos = InStr(Data.GetText, "*")
With ListBox1
.RemoveItem .ListIndex
End With
With ListBox2
.AddItem Left(Data.GetText, Pos - 1)
.Column(1, .ListCount - 1) = Right(Data.GetText, Pos - 1)
End With
End Sub |
Partager