呵呵,是很好玩,美中不足的是图片在放大与缩小的时候都设定为80/50,单元格的高度也是,其实多设定三个变量保存这三个原始数据,用来还原就可以了。 Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long Type POINTAPI X As Long Y As Long End Type Dim 开关 As Boolean Dim 原图 Dim 当前图 Dim XW As Integer, XH As Integer, XR As Integer Sub 停止缩放() 开关 = True End Sub Sub 单击缩放图片() Dim 座标 As POINTAPI, temp As Byte temp = Application.InputBox("你希望放大几倍?", "放大选项", 3, , , , , 1) If temp < 2 Or temp > 10 Then MsgBox "请输入2到10 !": Exit Sub On Error Resume Next 开关 = False Do If 开关 = True Then Exit Do GetCursorPos 座标 On Error Resume Next Set 当前图 = ActiveWindow.RangeFromPoint(座标.X, 座标.Y) If 当前图 Is Nothing Then If Not 原图 Is Nothing Then With 原图 .ZOrder msoBringToFront .Width = 80 .Height = 50 .TopLeftCell.Offset(0, 1).RowHeight = 50 End With End If Else If 当前图.Name <> 原图.Name Then With 原图 .ZOrder msoBringToFront .Width = XW .Height = XH .TopLeftCell.Offset(0, 1).RowHeight = XR End With With 当前图 XW = .Width XH = .Height XR = .TopLeftCell.Offset(0, 1).RowHeight .ZOrder msoBringToFront .Width = .Width * temp .Height = .Height * temp .TopLeftCell.Offset(0, 1).RowHeight = .Height End With End If End If Set 原图 = 当前图 On Error GoTo 0 DoEvents Loop 开关 = False End Sub 收藏!! |