多くのオブジェクトがあります 1 つのインターフェイスを実装します ユーザー インターフェイスだけを知っている 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
クラス終了