private void mainFrm_FormClosing(object sender, FormClosingEventArgs e)
{
// e.Cancel, true = 종료 취소, false = 종료 (default : false)
e.Cancel = true;
}
/* 활용안 : 특정 버튼으로만 종료시키고자 할 때 */
public class mainFrm : Form
{
bool _closeCancel = true;
// ... 생략 ....
private void btnClose_Click(object sender, EventArgs e)
{
_closeCancel = false;
this.Close();
}
private void mainFrm_FormClosing(object sender, FormClosingEventArgs e)
{
// e.Cancel, true = 종료 취소, false = 종료 (default : false)
e.Cancel = _closeCancel;
}
}