Or even easier, you can set DialogResult just after Close. For example, assuming ValidateSettings will show the user any problems with the form or return true otherwise:
private void btnOK_Click(object sender, EventArgs e)
{
if (ValidateSettings())
{
SaveSettings();
Close();
DialogResult = DialogResult.OK;
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…