0

有很多对象 实现一个界面 只知道用户界面如何通过 DragandDrop 传递对象?

Public Class test_1
    Implements I_NAME
    Public Property Name As String Implements I_NAME.Name
End Class

Public Class WPF_TEST

Private Sub txt_drop_source_MouseDown(sender As Object, e As MouseButtonEventArgs) Handles      txt_drop_source.MouseDown
    Dim obj As New test_1
    DragDrop.DoDragDrop(Me, obj, DragDropEffects.All)
End Sub

Private Sub txt_drop_DragEnter(sender As Object, e As DragEventArgs) Handles txt_drop.DragEnter
    If e.Data.GetDataPresent(GetType(I_NAME)) Then
        e.Effects = DragDropEffects.All
    End If
End Sub

Private Sub txt_drop_Drop(sender As Object, e As DragEventArgs) Handles txt_drop.Drop
    Dim obj As Object = e.Data.GetData(GetType(I_NAME))
    If IsNothing(obj) = False Then
        MsgBox(obj.ToString)
    End If
End Sub

结束类

4

0 回答 0