捕捉窗口关闭事件(转贴) - 中国WEB开发者网络 (http://www.webasp.net) -- 技术教程 (http://www.webasp.net/article/) --- 捕捉窗口关闭事件(转贴) (http://www.webasp.net/article/5/4805.htm) |
| -- 作者:未知 -- 发布日期: 2003-07-12 |
| public class whoisresult : System.Windows.Forms.Form { ............................. private bool TangSeng = false; } private void InitializeComponent() { ............................. this.Closing += new CancelEventHandler(this.whoisresult_Cancel); } protected void whoisresult_Cancel(object sender,CancelEventArgs e) { if(!TangSeng) { e.Cancel = true; TangSeng = true; MessageBox.Show("悟空,你也太调皮了,每次都要我提醒你,诶~~~"); } else { e.Cancel = false; MessageBox.Show("这次总算学乖了"); } } 窗体关闭事件可以取消,通过设置cancel属性 |
| webasp.net |