教程集 www.jiaochengji.com
教程集 >  操作系统  >  windows  >  正文 捕捉窗口关闭事件(转贴)

捕捉窗口关闭事件(转贴)

发布时间:2019-12-10   编辑:jiaochengji.com
教程集为您提供捕捉窗口关闭事件(转贴)等资源,欢迎您收藏本站,我们将为您提供最新的捕捉窗口关闭事件(转贴)资源
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属性
 

您可能感兴趣的文章:
捕捉窗口关闭事件(转贴)
onbeforeunload事件判断用户的在线状态
虎牙直播常见问题汇总
JavaScript捕获窗口关闭事件的代码举例
python怎么连接数据库
jQuery文本框(input textare)事件绑定方法教程
关于jquery input textare 事件绑定及用法学习
非常不错js弹出层效果代码
jsp剪贴板的复制粘贴程序
Vs.net MDI窗口的实现。

[关闭]
~ ~