控件在工具箱空白处点击右键--〉部件---〉Microsoft
Multimedia
Control
6.0
在窗体中添加下面这段代码:
Private
Sub
Form_Load()
MMC.FileName
=
App.Path
+
"\*.mp3"
MMC.Command
=
"Open"
MMC.Command
=
"Play"
End
Sub
工程→控件→windowsmediaplayer引用后左边控件列表中会多出一个东西,点它,在屏幕上画个框,mediaplayer就到屏幕上啦
接下来,制作文件打开工具
放置
drive1
dir1
file1
三个控件。把file1的pattern属性设为*.wma
然后写入如下代码
private
sub
dir1_change()
file1.path
=
dir1.path
end
sub
private
sub
drive1_change()
dir1.path
=
drive1.drive
end
sub
private
sub
file1_click()
windowsmediaplayer1.url
=
file1.path
&
"\"
&
file1.filename
end
sub
url是文件的路径,你也可以抛弃那三个控件,直接指定一个文件
至于视频嘛,也一样,可以放一个command1
caption属性设为"视频"
private
sub
command1_click()
file1.pattern="*.avi"
end
sub
为了能改回来,放一个command2
caption属性设为"音频"
private
sub
command2_click()
file1.pattern="*.wma"
end
sub
附加:全屏法:
放一个command3
caption属性设为"全屏"
private
sub
command3_click()
windowsmediaplayer1.fullscreen
end
sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)