检查用户是否单击关闭按钮

编程入门 行业动态 更新时间:2024-10-28 20:21:53
本文介绍了检查用户是否单击关闭按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

I am using vb form. I was wondering if there is an event (or way ) that check if when the user click the close form button? If yes, can you also cancel the form from closing ?

推荐答案

是的,有一种方法,奇怪的是,它被称为FormClosing事件,你只需要拦截它。 FormClosing事件 [ ^ ]对如何使用它有很好的参考。 Yes, there is a way, oddly enough, its called the FormClosing event, and you just need to intercept it. FormClosing Event[^] on MSDN has a good reference for how to use it.

是的,是的。 处理Form.FormClosing事件,它将会给你一个FormClosingEventArgs作为参数。 这包含一个属性 CloseReason [ ^ ]它会为您提供尽可能多的信息,并且还有取消 [ ^ ]您可以设置为 True 如果你想阻止它关闭。 注意:如果你总是取消表格关闭,你会严重惹恼你的用户!为他们提供一些机制...... Yes, and yes. Handle the Form.FormClosing event, and it will give you a FormClosingEventArgs as a parameter. This contains a property CloseReason[^] which gives you as much info as you are going to get, and also has a Cancel[^] property that you can set to True if you want to prevent it closing. Note: if you always cancel the Form Close, you will seriously annoy your users! Provide some mechanism for them to get out...

更多推荐

检查用户是否单击关闭按钮

本文发布于:2023-11-08 11:55:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1569302.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:单击   按钮   用户

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!