在PPT中实现任意拖放图片效果的方法
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
继续查找其他问题的答案?
-
2021-02-012次播放
-
2021-02-017次播放
-
2021-02-0157次播放
-
2021-02-017次播放
-
2021-02-0120次播放
-
2021-02-013次播放
-
2021-01-305次播放
-
PowerPoint 2019如何更改SmartArt图形的颜色?
2021-01-309次播放
-
2021-01-304次播放
-
2021-01-303次播放
点击加载更多评论>>