提示
来源:互联网 发布:ubuntu kylin 优麒麟 编辑:程序博客网 时间:2024/04/28 16:46
DialogResult result = MessageBox.Show("上書きしますか?",
"確認", MessageBoxButtons.YesNoCancel);
if (result.ToString() == "Yes")
{
if (System.IO.File.Exists(xo.xmlFilePath) == true)
{
xo.Doc.Save(xo.xmlFilePath);
EndEditor();
}
}
if (result.ToString() == "No")
{
EndEditor();
}
if (result.ToString() == "Cancel")
{
e.Cancel = true;
}
public const string MSG_TITLE_ERROR = "エラー";
public const string MSG_TITLE_CONFIRM = "確認";
public const string MSG_TITLE_WARNING = "警告";
public const string SAVE_CANCEL = "内容は保存されていません。/r/n/r/n保存しますか?";
DialogResult dr = MessageBox.Show(Consts.SAVE_CANCEL, Consts.MSG_TITLE_CONFIRM,
MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (dr == DialogResult.Yes)
{
SaveData();
}
else if (dr == DialogResult.No)
{
e.Cancel = true;
}