

 |
|
如何控制窗口的关闭事件
|
|
|
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属性
| |
|
上一篇:关于序列化-开心,转来一篇
下一篇:如何使窗体缩为系统托盘中的一个图标?
|
普克创业投资网刊载此文不代表同意其说法或描述,仅为提供更多信息。
|
|