http://msdn.microsoft.com/en-us/library/system.windows.forms.form.formclosing(v=vs.80).aspx
private void ConfigurationTool_FormClosing(object sender, FormClosingEventArgs e)
{
if (IsChanged())
{
DialogResult result = MessageBox.Show(Resources.ResourceManager.GetString("ConfirmeMessage"), Resources.ResourceManager.GetString("ProduceTitle"), MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
if (result != DialogResult.Yes)
{
e.Cancel = true;
}
}
}
{
if (IsChanged())
{
DialogResult result = MessageBox.Show(Resources.ResourceManager.GetString("ConfirmeMessage"), Resources.ResourceManager.GetString("ProduceTitle"), MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
if (result != DialogResult.Yes)
{
e.Cancel = true;
}
}
}
做个快乐的自己。