下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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 "
2、;user32" (ByVal xPoint As Long, ByVal 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
3、Lib "user32" (ByVal x As Long, ByVal y As Long) As LongPublic Declare 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 Privat
4、e Const SM_SCREENX = 0Private Const SM_SCREENY = 1Private Const sigProc = "Drag & Drop"Public Const VK_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
5、 Bottom As LongEnd Type Public mPoint As PointAPI, dPoint As PointAPIPublic ActiveShape As ShapeDim dragMode As BooleanDim dx As 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
6、 As IntegerDim mWnd As Long, WR As RECT dx = GetSystemMetrics(SM_SCREENX): dPoint.x = dxdy = GetSystemMetrics(SM_SCREENY): dPoint.y = dy GetCursorPos mPointWith ActivePresentation.SlideShowWindow mWnd = WindowFromPoint(mPoint.x, mPoint.y) GetWindowRect mWnd, WR sx = WR.Left sy = WR.Top dx = (WR.Righ
7、t - WR.Left) / ActivePresentation.PageSetup.SlideWidth dy = (WR.Bottom - WR.Top) / ActivePresentation.PageSetup.SlideHeightEnd 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
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 初中历史启蒙第一课
- TGXAS-精播用普通玉米杂交种子加工技术规范编制说明
- 小学生禁毒主题班会
- 物理《光现象》章末测试 2024-2025学年物理苏科版八年级上册
- 电商运营培训课件
- 广西玉林市福绵区2025届高中毕业生五月供题训练(二)语文试题含解析
- 广东省中山纪念中学2025届高三5月第一次单元测试-语文试题试卷含解析
- 广东省培正中学2025年招生全国统一考试4月(二诊)调研测试卷(康德版)语文试题含解析
- DB54T 0400-2024巨须裂腹鱼苗种温室水泥池培育技术规范
- 广东广州市2024-2025学年高三下学期总复习质量调查(一)语文试题试卷(理工类)含解析
- 光合作用的生理生态
- 德勤复赛竞答题题目
- 预防未成年犯罪法主题班会教案
- 电动螺丝刀扭力抽检规范
- 饲料车间安全风险分级清单
- 人教版五年级上册《生命.生态.安全》全册教案(及计划)
- 【讲话致辞】在创建全国义务教育优质均衡发展县和学前教育普及普惠县工作推进会上的讲话
- 计算机网络课程教学改革
- 西藏审美文化智慧树知到答案章节测试2023年西藏民族大学
- 妊娠合并甲减课件
- 有机化学-第二版-徐寿昌-课后习题参考答案(全)
评论
0/150
提交评论