收藏 分销(赏)

实现在PPT演示过程中-用鼠标拖动图片.doc

上传人:人****来 文档编号:3155050 上传时间:2024-06-21 格式:DOC 页数:5 大小:21.50KB
下载 相关 举报
实现在PPT演示过程中-用鼠标拖动图片.doc_第1页
第1页 / 共5页
实现在PPT演示过程中-用鼠标拖动图片.doc_第2页
第2页 / 共5页
实现在PPT演示过程中-用鼠标拖动图片.doc_第3页
第3页 / 共5页
实现在PPT演示过程中-用鼠标拖动图片.doc_第4页
第4页 / 共5页
实现在PPT演示过程中-用鼠标拖动图片.doc_第5页
第5页 / 共5页
亲,该文档总共5页,全部预览完了,如果喜欢就下载吧!
资源描述

1、实现在PPT演示过程中,用鼠标拖动图片1新建一个ppt空白文档。2点击菜单:“工具宏宏”,出现对话框。3对话框中“宏名”写:drop(其他也可以),再点“创建”,就进入代码模式。4“Sub drop() End Sub”,类似的三句全删掉。把下面的代码全拷贝进去。Option Explicit Declare Function GetKeyState Lib user32 (ByVal nVirtKey As Long) As IntegerPrivate Declare Function WindowFromPoint Lib user32 (ByVal xPoint As Long, By

2、Val yPoint As Long) As LongPrivate Declare Function GetWindowRect Lib user32 (ByVal hwnd As Long, lpRect As RECT) As LongPrivate Declare Function GetCursorPos Lib user32 (lpPoint As PointAPI) As LongPrivate Declare Function SetCursorPos Lib user32 (ByVal x As Long, ByVal y As Long) As LongPublic Dec

3、lare Function MonitorFromPoint Lib user32.dll (ByVal x As Long, ByVal y As Long, ByVal dwFlags As Long) As LongPrivate Declare Function GetSystemMetrics Lib user32 (ByVal nIndex As Long) As Long Private Const SM_SCREENX = 0Private Const SM_SCREENY = 1Private Const sigProc = Drag & DropPublic Const V

4、K_SHIFT = &H10Public Const VK_CTRL = &H11Public Const VK_ALT = &H12 Private Type PointAPI x As Long y As LongEnd Type Public Type RECT Left As Long Top As Long Right As Long Bottom As LongEnd Type Public mPoint As PointAPI, dPoint As PointAPIPublic ActiveShape As ShapeDim dragMode As BooleanDim dx A

5、s Double, dy As Double Sub DragandDrop(sh As Shape) dragMode = Not dragMode If dragMode Then Drag sh End Sub Private Sub Drag(sh As Shape)Dim i As Integer, sx As Integer, sy As IntegerDim mWnd As Long, WR As RECT dx = GetSystemMetrics(SM_SCREENX): dPoint.x = dxdy = GetSystemMetrics(SM_SCREENY): dPoi

6、nt.y = dy GetCursorPos mPointWith ActivePresentation.SlideShowWindow mWnd = WindowFromPoint(mPoint.x, mPoint.y) GetWindowRect mWnd, WR sx = WR.Left sy = WR.Top dx = (WR.Right - WR.Left) / ActivePresentation.PageSetup.SlideWidth dy = (WR.Bottom - WR.Top) / ActivePresentation.PageSetup.SlideHeightEnd

7、With If dx dy Then sx = sx + (dx - dy) * ActivePresentation.PageSetup.SlideWidth / 2 dx = dyEnd IfIf dy dx Then sy = sy + (dy - dx) * ActivePresentation.PageSetup.SlideHeight / 2 dy = dxEnd If While dragMode GetCursorPos mPoint sh.Left = (mPoint.x - sx) / dx - sh.Width / 2 sh.Top = (mPoint.y - sy) / dy - sh.Height / 2 DoEvents i = i + 1: If i 2000 Then dragMode = False: Exit SubWend End Sub5点击保存后,关闭代码模式,回到ppt设计页面。在你需要拖动的图片上点右键,选择“动作设置单击鼠标运行宏确定”。然后就看效果吧。 (注:专业文档是经验性极强的领域,无法思考和涵盖全面,素材和资料部分来自网络,供参考。可复制、编制,期待你的好评与关注)

展开阅读全文
部分上传会员的收益排行 01、路***(¥15400+),02、曲****(¥15300+),
03、wei****016(¥13200+),04、大***流(¥12600+),
05、Fis****915(¥4200+),06、h****i(¥4100+),
07、Q**(¥3400+),08、自******点(¥2400+),
09、h*****x(¥1400+),10、c****e(¥1100+),
11、be*****ha(¥800+),12、13********8(¥800+)。
相似文档                                   自信AI助手自信AI助手
百度文库年卡

猜你喜欢                                   自信AI导航自信AI导航
搜索标签

当前位置:首页 > 包罗万象 > 大杂烩

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        获赠5币

©2010-2024 宁波自信网络信息技术有限公司  版权所有

客服电话:4008-655-100  投诉/维权电话:4009-655-100

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :gzh.png    weibo.png    LOFTER.png 

客服