我如何使用Esc按钮 [英] How can i use the esc button

查看:123
本文介绍了我如何使用Esc按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友
我写了类似
的代码

Hi friends
i write a code like

Private Sub flash_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
    If e.KeyCode = Keys.Escape Then
        Me.Close()
    End If
End Sub


在vb.net中,代码是有效的.但是,当我在运行表单后在表单设计上拖放棚波Flash对象控件时,上面的代码不起作用.如何解决此问题????
谢谢大家.....


In vb.net the code is work.But when i drag and drop the shack wave flash object control on form designing after i run the form the above code does not work.How can i rectify this problem???
Advance thanks to all.....

推荐答案

这不是关闭窗口的好方法.如果将窗口显示为模式窗口(通过ShowDialog),则需要使用CancelButton;否则,请使用CancelButton.表单在退出时会自行关闭:
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.cancelbutton.aspx [ ^ ].

而且,如果该窗体不是模式窗体,则永远不要使用Escape将其关闭,因为它会违反预期的UI样式,并且由于明显的原因而可能导致用户工作丢失.

—SA
This is not a good way to close a window. If you show a window as modal (via ShowDialog), you need to use CancelButton; and the form will close itself on escape:
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.cancelbutton.aspx[^].

And if the form is not modal, you should never close it with Escape, as it will violated expected UI style and can cause loss of user''s work, by apparent reasons.

—SA


这篇关于我如何使用Esc按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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