如何知道用户在不保存的情况下关闭打开的对话框?

How to know user close open dialog without saving?

SaveFileDialog sfd = new SaveFileDialog();

sfd.ShowDialog();
sfd.Filter("Wave Files|*.wav");
ss.SetOutPutToWaveFile(sfd.FileName);
ss.Speak(richTextbox.Text);
ss.SetOutputToDefaultAudioDevice();
if (sfd.ShowDialog() == DialogResult.OK){

  //user  saved it
}
else {

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

使用 sfd.ShowDialog() 中的 return 值:

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