拖放是用鼠標拖動一個文件到其它對象的活動
首先介紹與拖放有關的控件
DragIcon確定在拖動過程中顯示的指針的圖標形狀
DragOver事件發生於拖動操作完成時
DragDrop事件發生於拖動操作正在進行時
然後編寫一個小程序
立窗口Form
Form
Option Explicit
Dim dragx As Single
Dim dragy As Single
Const BEGIN_DRAG=
Private Sub Form_DragDrop(Source As Control
Image
Form
Image
End Sub
Private Sub Form_Load()
Load Form
Form
End Sub
Private Sub Image
X As Single
dragx=X
dragy=Y
Image
Image
End Sub
Form
Option Explicit
Dim dragx As Single
Dim dragy As Single
Const BEGIN_DRAG=
Private Sub Form_DragDrop(Source As Control
Image
Form
Image
End Sub
Private Sub Image
X As Single
dragx=X
dragy=Y
Image
Image
End Sub
本程序在VB
From:http://tw.wingwit.com/Article/program/net/201311/13801.html