如何使用“保存"对话框在C#中保存录制的声音 [英] how to save recorded sound in C# with save dialog box
本文介绍了如何使用“保存"对话框在C#中保存录制的声音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经用C#录制了声音,它还保存了录制的声音,但是存储在固定位置..
我想提供一个保存对话框以保存该文件..怎么做..请帮助我..谢谢..我在这里发布我的代码..
i have done sound recording in C# it also save the recorded sound but at fixed location..
i want to provide save dialog box to save that file..how to do..please help me..thanks..i am posting my code here..
private void savestopbutton_Click(object sender, RoutedEventArgs e)
{
textBox1.Text = "";
DispatcherTimer dispatcherTimer = new DispatcherTimer();
dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
interval = new TimeSpan(0, 0, 0);
dispatcherTimer.Interval = interval;
dispatcherTimer.Stop();
mciSendString("save recsound d:\\WPF\\record.wma", "", 0, 0);
mciSendString("close recsound ", "", 0, 0);
Computer c = new Computer();
c.Audio.Stop();
}
推荐答案
显示保存对话框表单,并允许用户选择路径.
捕获由他选择的路径的字符串,并将其放置在mciSendString("save recsound d:\\WPF\\record.wma"
行中(而不是硬编码的路径和文件名).
Show a save dialog form and allow the user to choose the path.
Capture the string of the path selected by him and place it in themciSendString("save recsound d:\\WPF\\record.wma"
line (instead of the hardcoded path and file name).
这篇关于如何使用“保存"对话框在C#中保存录制的声音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文