第一次接触这东西,不知道具体的代码流程是什么样的, 希望各位朋友能给个简单的小例子借鉴一下,先谢谢啦。
解决方案 »
- 如何正确使用INSERT将数据插入表中?
- the UpdateCommand affected 0 of the expected 1 records请帮忙解决,谢谢
- 交错数组 递归 组合算法求助!
- 简单正则问题第七问
- string 字串 如何转为 xml 文档
- vs2003中 关闭子窗体回传参数到父窗体
- 如何把一个object对象转换成ARRAYLIST 对象???
- 怎么控制随机函数的概率阿!谢谢!
- 现在我需要持久的实时的同时向100个网页请求获取数据,每个网页都是每隔3秒重新请求一次,
- 关于用c#制作服务程序的问题,高手请看过来!!!
- 我是不是被黑了?怎么解决呀
- TreeListView的控件
{
static AutoResetEvent _playEvent = new AutoResetEvent(true);
/// <summary>
/// 播放声音文件
/// </summary>
/// <param name="fileName">声音文件的名称</param>
public static void Play(string fileName)
{
_playEvent.WaitOne();
try
{
string applicationDirectory = Directory.GetCurrentDirectory();
applicationDirectory += @"\GC_Sound\";
if (File.Exists(applicationDirectory + fileName))
{
SoundPlayer _currentPlayer = new SoundPlayer(applicationDirectory + fileName);
_currentPlayer.Load();
if (_currentPlayer.IsLoadCompleted == true)
_currentPlayer.PlaySync();
}
}
finally
{
_playEvent.Set();
}
}
}
我写的播放文件的类。
static AutoResetEvent _playEvent = new AutoResetEvent(true);
用来线程同步的信号量,你可以不用管它。他的作用是,限制必须在播放一段声音之后,再去播放另外一段声音。
private AxMediaPlayer.AxMediaPlayer axWindowsMediaPlayer1;
if(openFileDialog1.ShowDialog()==DialogResult.OK)
{
axWindowsMediaPlayer1.FileName = openFileDialog1.FileName;
}
http://topic.csdn.net/u/20091205/22/42b20870-34dc-4b30-9465-1b618e260b03.html
this.axWindowsMediaPlayer1.URL = str1;//str1音乐文件的绝对路径
this.axWindowsMediaPlayer1.Ctlcontrols.play();