最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
如何控制窗口的关闭事件
时间:2022-07-02 11:40:17 编辑:袖梨 来源:一聚教程网
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属性
{
.............................
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属性
相关文章
- HOME币购买步骤-2025币安交易所快速教程 06-15
- 奇迹暖暖第三卷第三章支线1怎么怎么搭配最强 06-15
- 仙剑世界雾北区易家故院解密宝箱快速获取指南 06-15
- 逆水寒手游废村宝箱密码一览攻略 06-15
- CZ:我沒喊單!Aster市佔飆至20%,和Hyperliquid搶奪Perp DEX頂位 06-15
- 蛋仔派对精灵莉斯尔盲盒概率攻略 06-15