实现在PPT演示过程中用鼠标拖动图片_第1页
实现在PPT演示过程中用鼠标拖动图片_第2页
实现在PPT演示过程中用鼠标拖动图片_第3页
实现在PPT演示过程中用鼠标拖动图片_第4页
免费预览已结束,剩余1页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

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, B

2、yVal 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 De

3、clare 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

4、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 Bottom As LongEnd Type Public mPoint As PointAPI, dPoint As PointAPIPublic ActiveShape As ShapeDim dragMode As BooleanDim dx

5、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 As IntegerDim mWnd As Long, WR As RECT dx = GetSystemMetrics(SM_SCREENX): dPoint.x = dxdy = GetSystemMetrics(SM_SCREENY): dPo

6、int.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 T

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论