1、插入图片(这个不能用插入图片的方法,而是通过图片控件(image控件)的方法,如下图:
2、双击图像控件,输入以下代码:
Dim X1, Y1 As Integer '用来记录位置
Dim Down As Boolean '用来判断拖放状态
Dim X2, Y2 As Integer
Dim Down2 As Boolean
'——————————————————————————
Private Sub Image1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
'按下并记录位置
If Not Down Then
X1 = X
Y1 = Y
Down = True
End If
End Sub
Private Sub Image1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
'记算移动距离
If Down Then
Image1.Left = Image1.Left + X - X1
Image1.Top = Image1.Top + Y - Y1
X1 = X
Y1 = Y
End If
End Sub
Private Sub Image1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
'改变移动状态并显示移动后的图片
Down = False
SlideShowWindows(1).View.First
End Sub
已有 22658 名学员学习以下课程通过考试
最需教育客户端 软件问题一手掌握
去 App Store 免费下载 iOS 客户端
点击加载更多评论>>