如何知道用户关闭打开对话框而不保存?

时间:2015-09-04 13:54:43

标签: c# opendialog

SaveFileDialog sfd = new SaveFileDialog();

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

2 个答案:

答案 0 :(得分: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
}

答案 1 :(得分:2)

使用checkbox.setFieldFlags(PDField.FLAG_READ_ONLY); 的返回值:

sfd.ShowDialog()