c#winform点击按钮发出响声
答案:2 悬赏:0 手机版
解决时间 2021-02-02 04:37
- 提问者网友:末路
- 2021-02-01 14:05
c#winform点击按钮发出响声
最佳答案
- 五星知识达人网友:封刀令
- 2021-02-01 15:11
可以考虑引用DLL文件播放一个声音,主要是因为有些电脑上面没有播放器,直接执行
1. wav会报错;
请参考:
private AxWMPLib.AxWindowsMediaPlayer wmp;
if ((wmp.playState == WMPLib.WMPPlayState.wmppsUndefined || wmp.playState == WMPLib.WMPPlayState.wmppsStopped) && File.Exists(Application.StartupPath + "\\1.wav"))
{
wmp.Ctlcontrols.pause();
string callPath = Application.StartupPath + "\\1.wav";
wmp.URL = callPath;
}
//停止音乐播放
if (
(wmp.playState != WMPLib.WMPPlayState.wmppsUndefined ||
wmp.playState != WMPLib.WMPPlayState.wmppsStopped))
{
wmp.Ctlcontrols.stop();
}
1. wav会报错;
请参考:
private AxWMPLib.AxWindowsMediaPlayer wmp;
if ((wmp.playState == WMPLib.WMPPlayState.wmppsUndefined || wmp.playState == WMPLib.WMPPlayState.wmppsStopped) && File.Exists(Application.StartupPath + "\\1.wav"))
{
wmp.Ctlcontrols.pause();
string callPath = Application.StartupPath + "\\1.wav";
wmp.URL = callPath;
}
//停止音乐播放
if (
(wmp.playState != WMPLib.WMPPlayState.wmppsUndefined ||
wmp.playState != WMPLib.WMPPlayState.wmppsStopped))
{
wmp.Ctlcontrols.stop();
}
全部回答
- 1楼网友:鸠书
- 2021-02-01 16:20
搜一下:c#winform点击按钮发出响声
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯