建立ppt
1.在ppt中新建空幻燈片。
2.選擇”檢視→工具欄→控制元件工具箱”選單,開啟控制元件工具箱。
新增程式碼
雙擊label,或選擇”工具→宏→visualbasic編輯器”選單,開啟vba,選擇label1物件,再選擇對應的mousedown、mousemove和mouseup事件,加入以下程式碼:
dimx1,x2,x3,x4,x5,x6asinteger,y1,y2,y3,y4,y5,y6asinteger,downasboolean‘設定全域性變數,x1、y1等為label1等物件的初始座標值
privatesublabel1_mousedown(byvalbuttonasinteger,byvalshiftasinteger,byvalxassingle,byvalyassingle)
ifnotdownthen
x1=x
y1=y
down=true
endif
endsub
privatesublabel1_mousemove(byvalbuttonasinteger,byvalshiftasinteger,byvalxassingle,byvalyassingle)
’如果滑鼠已按下,設定label1新的座標值
ifdownthen
label1.left=label1.leftx-x1
label1.top=label1.topy-y1
privatesublabel1_mouseup(byvalbuttonasinteger,byvalshiftasinteger,byvalxassingle,byvalyassingle)
down=false
slideshowwindows(1).view.first’重新整理螢幕,使用powerpointxp/2003時加入此句
為image1加入以下vba程式碼:
privatesubimage1_mousedown(byvalbuttonasinteger,byvalshiftasinteger,byvalxassingle,byvalyassingle)
x4=x
y4=y
privatesubimage1_mousemove(byvalbuttonasinteger,byvalshiftasinteger,byvalxassingle,byvalyassingle)
’如果滑鼠已按下,設定label1新的座標值。
image1.left=image1.leftx-x4
image1.top=image1.topy-y4
privatesubimage1_mouseup(byvalbuttonasinteger,byvalshiftasinteger,byvalxassingle,byvalyassingle)
建立ppt
1.在ppt中新建空幻燈片。
2.選擇”檢視→工具欄→控制元件工具箱”選單,開啟控制元件工具箱。
新增程式碼
雙擊label,或選擇”工具→宏→visualbasic編輯器”選單,開啟vba,選擇label1物件,再選擇對應的mousedown、mousemove和mouseup事件,加入以下程式碼:
dimx1,x2,x3,x4,x5,x6asinteger,y1,y2,y3,y4,y5,y6asinteger,downasboolean‘設定全域性變數,x1、y1等為label1等物件的初始座標值
privatesublabel1_mousedown(byvalbuttonasinteger,byvalshiftasinteger,byvalxassingle,byvalyassingle)
ifnotdownthen
x1=x
y1=y
down=true
endif
endsub
privatesublabel1_mousemove(byvalbuttonasinteger,byvalshiftasinteger,byvalxassingle,byvalyassingle)
’如果滑鼠已按下,設定label1新的座標值
ifdownthen
label1.left=label1.leftx-x1
label1.top=label1.topy-y1
x1=x
y1=y
endif
endsub
privatesublabel1_mouseup(byvalbuttonasinteger,byvalshiftasinteger,byvalxassingle,byvalyassingle)
down=false
slideshowwindows(1).view.first’重新整理螢幕,使用powerpointxp/2003時加入此句
endsub
為image1加入以下vba程式碼:
privatesubimage1_mousedown(byvalbuttonasinteger,byvalshiftasinteger,byvalxassingle,byvalyassingle)
ifnotdownthen
x4=x
y4=y
down=true
endif
endsub
privatesubimage1_mousemove(byvalbuttonasinteger,byvalshiftasinteger,byvalxassingle,byvalyassingle)
’如果滑鼠已按下,設定label1新的座標值。
ifdownthen
image1.left=image1.leftx-x4
image1.top=image1.topy-y4
x4=x
y4=y
endif
endsub
privatesubimage1_mouseup(byvalbuttonasinteger,byvalshiftasinteger,byvalxassingle,byvalyassingle)
down=false
slideshowwindows(1).view.first’重新整理螢幕,使用powerpointxp/2003時加入此句
endsub