2015-09-04 48 views
0
SaveFileDialog sfd = new SaveFileDialog(); 

sfd.ShowDialog(); 
sfd.Filter("Wave Files|*.wav"); 
ss.SetOutPutToWaveFile(sfd.FileName); 
ss.Speak(richTextbox.Text); 
ss.SetOutputToDefaultAudioDevice(); 
+0

如果不明白我在問,請告訴我。謝謝 – kch4416

+0

https://msdn.microsoft.com/en-us/library/e61ft40c%28v=vs.110%29.aspx – theB

回答

2

sfd.ShowDialog()使用返回值:

if (sfd.ShowDialog() == DialogResult.OK) 
{ 
    // File was selected 
} 
else 
{ 
    // Cancelled 
} 
3
if (sfd.ShowDialog() == DialogResult.OK){ 

    //user saved it 
} 
else { 

    //write code to handle the case when an user does't save , and canceled it 
} 
+0

該對話框將顯示兩次。 – Dmitry

+0

請勿使用sfd.ShowDialog();了。抹掉這一行。像我所展示的那樣使用它。 – Viva