VB.NET 添加控件方法-“Windows Media Player”组件

发布时间 2023-11-12 23:51:33作者: 路飞园
“工具箱”——“所有Windows窗体”中单击右键,选择“选择项”菜单

 

打开“选择工具箱项”窗口,选择“COM组件”标签,
在列表中找到并勾选“Windows Media Player”组件,单击“确定”按钮

 

 

将该组件添加到指定的工具箱选项卡中
然后在工具箱里面找 Windows Media Player 控件
拉到form里面

 


拉出来的控件就是AxWindowsMediaPlayer

 

AxWindowsMediaPlayer1.URL = "music\ALARM1.wav" '调用相对路径文件
Me.AxWindowsMediaPlayer1.Ctlcontrols.play()  '播放