命令在alt + f4键上 [英] command on alt + f4 key

查看:198
本文介绍了命令在alt + f4键上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两种形式,我使用一种形式作为mdiparent。如果mdichildren处于活动状态,我将命令添加到无法关闭。我把它放在mdiparent private sub form_closed上。它适用于退出菜单条和关闭按钮(x)。但是当我们使用Alt + F4键时它不会产生任何影响。我应该把命令放在哪里?



 如果 MdiChildren.Count> ;  0  然后 
MessageBox.Show( 关闭所有表格! 警告! ,MessageBoxButtons.OK,MessageBoxIcon.Warning)
e.Cancel = True
否则
如果 MdiChildren.Count = 0 MessageBox.Show( 你想要关闭你的程序吗? 警告!,MessageBoxButtons.YesNo,MessageBoxIcon.Warning)= Windows.Forms.DialogResult.No 然后
e.Cancel = True
Else
e.Cancel = False
结束 如果
结束 如果

解决方案

为了验证关闭操作并能够取消它,请将代码放在关闭 [ ^ ]方法。

i have a couple of form and i use one form as mdiparent. i add command to unabled close if there's mdichildren active. i put it on mdiparent private sub form_closed. it work on exit menu strip and close button (x). but it not take any effect when we use Alt+F4 key. where should i put the command?

If MdiChildren.Count > 0 Then
            MessageBox.Show("Close All Form!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning)
            e.Cancel = True
        Else
            If MdiChildren.Count = 0 And MessageBox.Show("You Want To Close Your Program?", "Warning!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) = Windows.Forms.DialogResult.No Then
                e.Cancel = True
            Else
                e.Cancel = False
            End If
        End If

解决方案

In order to verify the close operation and to be able to cancel it, place the code in Closing[^] method.


这篇关于命令在alt + f4键上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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