欢迎来到天天文库
浏览记录
ID:55704479
大小:19.00 KB
页数:3页
时间:2020-05-25
《实现在PPT演示过程中,用鼠标拖动图片.doc》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、实现在PPT演示过程中,用鼠标拖动图片(绝对实用)张家营子镇九年一贯制学校马寅 1.新建一个ppt空白文档。2.点击菜单:“工具——宏——宏”,出现对话框。3.对话框中“宏名”写:drop(其他也可以),再点“创建”,就进入代码模式。4.“Subdrop()''宏由番茄花园创建,日期2010-4-8。'EndSub”,类似的三句全删掉。把下面的代码全拷贝进去。————————————————————————————————OptionExplicitDeclareFunctionGetKeyStateLib"user32"(ByValnVirtKeyAsLong)As
2、IntegerPrivateDeclareFunctionWindowFromPointLib"user32"(ByValxPointAsLong,ByValyPointAsLong)AsLongPrivateDeclareFunctionGetWindowRectLib"user32"(ByValhwndAsLong,lpRectAsRECT)AsLongPrivateDeclareFunctionGetCursorPosLib"user32"(lpPointAsPointAPI)AsLongPrivateDeclareFunctionSetCursorPosLib
3、"user32"(ByValxAsLong,ByValyAsLong)AsLongPublicDeclareFunctionMonitorFromPointLib"user32.dll"(ByValxAsLong,ByValyAsLong,ByValdwFlagsAsLong)AsLongPrivateDeclareFunctionGetSystemMetricsLib"user32"(ByValnIndexAsLong)AsLongPrivateConstSM_SCREENX=0PrivateConstSM_SCREENY=1PrivateConstsigProc=
4、"Drag&Drop"PublicConstVK_SHIFT=&H10PublicConstVK_CTRL=&H11PublicConstVK_ALT=&H12PrivateTypePointAPIxAsLongyAsLongEndTypePublicTypeRECTLeftAsLongTopAsLongRightAsLongBottomAsLongEndTypePublicmPointAsPointAPI,dPointAsPointAPIPublicActiveShapeAsShapeDimdragModeAsBooleanDimdxAsDouble,dyAsDou
5、bleSubDragandDrop(shAsShape)dragMode=NotdragModeIfdragModeThenDragsh EndSubPrivateSubDrag(shAsShape)DimiAsInteger,sxAsInteger,syAsIntegerDimmWndAsLong,WRAsRECTdx=GetSystemMetrics(SM_SCREENX):dPoint.x=dxdy=GetSystemMetrics(SM_SCREENY):dPoint.y=dyGetCursorPosmPointWithActivePresentation.S
6、lideShowWindowmWnd=WindowFromPoint(mPoint.x,mPoint.y)GetWindowRectmWnd,WRsx=WR.Leftsy=WR.Topdx=(WR.Right-WR.Left)/ActivePresentation.PageSetup.SlideWidthdy=(WR.Bottom-WR.Top)/ActivePresentation.PageSetup.SlideHeightEndWithIfdx>dyThensx=sx+(dx-dy)*ActivePresentation.PageSetup.SlideWidth/
7、2dx=dyEndIfIfdy>dxThensy=sy+(dy-dx)*ActivePresentation.PageSetup.SlideHeight/2dy=dxEndIfWhiledragModeGetCursorPosmPointsh.Left=(mPoint.x-sx)/dx-sh.Width/2sh.Top=(mPoint.y-sy)/dy-sh.Height/2DoEventsi=i+1:Ifi>2000ThendragMode=False:ExitSubWendEndSub5.点击保存后,关闭代码模式,回到ppt设计页面。在你需要拖动
此文档下载收益归作者所有