Class MainWindowクラスの全コード
Class MainWindow
Dim dataObj As IDataObject
Dim FileName() As String
Public Sub New()
' この呼び出しはデザイナーで必要です。
InitializeComponent()
AddHandler TextBlock1.Drop, AddressOf Textblock1_Drop
AddHandler TextBlock1.DragEnter, AddressOf Textblock1_DragEnter
AddHandler TextBlock1.DragLeave, AddressOf Textblock1_DragLeave
End Sub
Private Sub Textblock1_Drop(ByVal sender As Object, ByVal e As DragEventArgs)
dataObj = CType(e.Data, IDataObject)
FileName = dataObj.GetData(DataFormats.FileDrop)
TextBox1.Text = "Drop " & FileName(0)
End Sub
Private Sub Textblock1_DragEnter(ByVal sender As Object, ByVal e As DragEventArgs)
dataObj = CType(e.Data, IDataObject)
FileName = dataObj.GetData(DataFormats.FileDrop)
TextBox1.Text = "DragEnter " & FileName(0)
End Sub
Private Sub Textblock1_DragLeave(ByVal sender As Object, ByVal e As DragEventArgs)
dataObj = CType(e.Data, IDataObject)
FileName = dataObj.GetData(DataFormats.FileDrop)
TextBox1.Text = "DragLeave " & FileName(0)
End Sub
End Class