VB dragdrop事件到底怎么用呀 谁能举个例子

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/28 22:14:20
VB dragdrop事件到底怎么用呀 谁能举个例子

VB dragdrop事件到底怎么用呀 谁能举个例子
VB dragdrop事件到底怎么用呀 谁能举个例子

VB dragdrop事件到底怎么用呀 谁能举个例子

参考:http://iask.sina.com.cn/b/5207783.html

Option Explicit
    Dim cx As Long, cy As Long

Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single) '在FORM的dragdrop事件中移动控件
    Source.Move X - cx, Y - cy
End Sub

Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) '记录当前鼠标位置并开始拖动
    Picture1.Drag 1
    cx = X
    cy = Y
End Sub

Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) '结束拖动
    Picture1.Drag 2
End Sub