Public Class Form1 '先引用此库 '再创建一个实例 Dim sDrag As New getDragFilePathName.DragDropFiles Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load '注册窗体为容器 sDrag.DragDropHwnd = Me.Handle '加载库文件 sDrag.DragDropLoad() End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click '获取路径: TextBox1.Text = sDrag.DragDropFiles(0) End Sub End Class