' 1. 窗体的AllowDrop属性设置为True ; ' 2. 写入窗体的DragDrop事件: Private Sub Form1_DragDrop(sender As Object, e As DragEventArgs) Handles MyBase.DragDrop Try Dim filePath() As String = e.Data.GetData(DataFormats.FileDrop) For Each file As String In filePath txtFilePath.Text = file Next Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub ' 3. 写入窗体的DragEnter事件: Private Sub Form1_DragEnter(sender As Object, e As DragEventArgs) Handles MyBase.DragEnter Try If e.Data.GetDataPresent(DataFormats.FileDrop) Then e.Effect = DragDropEffects.Copy Else e.Effect = DragDropEffects.None End If Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub