当用户单击外部时关闭窗体 [英] close windows form when users click outside

查看:24
本文介绍了当用户单击外部时关闭窗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道如何编写代码,如果用户单击窗体外的窗体,窗体会自动关闭吗?即,我有两个表单,当我显示 form2 然后我在它外面单击时,表单 2 将关闭.

anybody have an idea how to write a code if the user clicks outside windows form, the form will automatically close? I.e., I had two forms, when i show form2 and then i click outside of it, form 2 will closed.

推荐答案

这有帮助吗?尝试前两种解决方案,其中一种应该适合您.

Does this help? Try the first two solutions, one of which should work for you.

Winforms:在对话框外单击时关闭模态对话框

这篇关于当用户单击外部时关闭窗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆