不使用命令按钮reg关闭表单 [英] Closing a form without using command button- reg

查看:82
本文介绍了不使用命令按钮reg关闭表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,

如何在不使用命令按钮的情况下关闭表单?我需要通过
关闭表格 键盘.有人可以在这方面帮助我吗?

谢谢和问候,
A.Harisankar

解决方案

Alt + F4.

应该在所有情况下都可以工作,而无需任何编程工作,最好不要禁用它.
您已经有了Rob的程序化Close的答案,另请参阅我对他的答案的评论.

有问题吗?


您可以使用错误... Close()关闭表单.您可能可以添加一个按键事件来检查按键并在其中保持关闭状态.您想关闭表格的键是什么?如果您将重点放在子控件上,则可能无法正常工作,在这种情况下,您需要挂接WNDPROC底层(假定这是WinForms而不是WPF)-我认为它位于PreProcessControlMessage上.

当然,您不应该这样做,因为您将偏离Windows设计指南,并且创建的应用程序不会像人们习惯的那样起作用.


Dear All,

How to close a form without using command button?. I need to close a form through
keyboard. Can anyone help me for this regards?

Thanks and Regards,
A.Harisankar

解决方案

Alt+F4.

Should work in all cases without any programming effort, and it''s the best not to disable it.
You already have the Answer on programmatic Close by Rob, see also my comments to his Answer.

Any problems?


You can close a form with err... Close(). You can probably add a key press event to check for the key and stick the close in there. What key do you want to close the form? That may not work if you have child controls focused, in which case you need to hook the (presuming this is WinForms and not WPF) underlying WNDPROC - which I think is on PreProcessControlMessage.

Of course, you shouldn''t do this as you''re going away from the Windows design guidelines and creating an application which doesn''t behave in the way people are used to.


这篇关于不使用命令按钮reg关闭表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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