如何使用OK按钮上的Alt O. [英] How do Alt O on OK button

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

问题描述

如何解决这个问题,以便当用户使用Alt-X时,

表格上的某个按钮会被触发?


另外,怎么做我修复它,以便当按下esc键时,表格是否已关闭?

How do I fix it so that when the user preses Alt-X a certain button on the
form gets fired?

Also, How do I fix it so that when the esc key is pressed, the form is
closed?

推荐答案

Woody,
如何修复它,以便当用户在
上按下Alt-X某个按钮时表单被触发?
如果您的表单有菜单,您可以添加隐藏的菜单项,使用Alt-X作为快捷方式的
。虽然它们是隐藏的,但MenuItem.Click事件仍然会被提升。


或者,如果您的按钮在标签中有X,则可以在X前加上一个

&显示时强制显示X.然后当你运行


例如,如果我将btnExit.Text属性设置为E& xit,我可以使用Alt-X

来点击那个按钮。

另外,如何修复它,以便在按下esc键时,表格是否已关闭?


将Form.CancelButton属性设置为其

点击事件中包含Me.Close的按钮。或者,如果将此

控件的Button.DialogResult设置为DialogResult.Cancel,则无需处理该事件,

表格将关闭。 (对于我使用Form.ShowDialog的表单执行此操作,我有

未使用Form.Show上的表单进行测试)。


希望这个帮助

Jay


" Woody Splawn" < WO *** @ splawns.com>在消息中写道

news:uM ************* @ tk2msftngp13.phx.gbl ...如何修复它以便用户在使用Alt-X时
表单上的某个按钮被触发了吗?

另外,如何修复它,以便在按下esc键时,表单被关闭?
How do I fix it so that when the user presses Alt-X a certain button on the form gets fired? If your form has a menu, you can add hidden menu items that use the Alt-X as
a short cut. Although they are hidden the MenuItem.Click event will still be
raised.

Alternatively if your button has X in the label, you can prefix the X with a
& making the X underscored when displayed. Then when your run the

For example if I set the btnExit.Text property to "E&xit", I can use Alt-X
to click that button.
Also, How do I fix it so that when the esc key is pressed, the form is
closed?
Set the Form.CancelButton property to the button that has Me.Close in its
click event. Alternatively if you set the Button.DialogResult for this
control to DialogResult.Cancel, you do not need to handle the event, the
form will close. (I do this for forms that I use Form.ShowDialog on, I have
not tested with forms I use Form.Show on).

Hope this helps
Jay

"Woody Splawn" <wo***@splawns.com> wrote in message
news:uM*************@tk2msftngp13.phx.gbl... How do I fix it so that when the user preses Alt-X a certain button on the
form gets fired?

Also, How do I fix it so that when the esc key is pressed, the form is
closed?



更改标题,以便&就在HotKey之前。例如


& OK将使Alt-O触发按钮,E& xit将使Alt-X触发按钮。


Woody Splawn < WO *** @ splawns.com>在消息新闻中写道:uM ************* @tk2msftngp13.phx.gbl ...
Change your caption so that a & is right before the HotKey. For example

&OK will make Alt-O fire the button, E&xit will make Alt-X fire the button.

"Woody Splawn" <wo***@splawns.com> wrote in message news:uM*************@tk2msftngp13.phx.gbl...
如何修复它以便用户在使用Alt-X时
表单上的某个按钮被触发了吗?

另外,如何修复它,以便在按下esc键时,表单被关闭?
How do I fix it so that when the user preses Alt-X a certain button on the
form gets fired?

Also, How do I fix it so that when the esc key is pressed, the form is
closed?



嗨Woody,在你的按钮文字中,是否出现字母x?如果是这样,你

可以用&符号前缀''x'':


Text =" E& xit"


X将显示下划线(除非您使用带有

的Windows 2000/2003 / XP,在按下Alt键之前关闭下划线),并且将响应Alt + X


另外,如果你将表单的KeyPreview属性设置为True,那么你可以

在表格的KeyPress事件中捕获Escape键。 br />

-

HTH,

- Tom Spink,überGeek


请回复新闻组,

所以所有人都可以受益


" System.Reflection Master"


====转换为2002 ====

删除内联声明

" Woody Splawn < WO *** @ splawns.com>在消息中写道

news:uM ************* @ tk2msftngp13.phx.gbl ...
Hi Woody, in the text of your button, does the letter ''x'' appear? If so, you
can prefix ''x'' with an ampersand (&):

Text = "E&xit"

The X will appear underlined (unless your using Windows 2000/2003/XP with
the underlining turned off until Alt is pressed), and will respond to Alt+X

Also, if you set the KeyPreview property of your form to True, then you can
trap the Escape key in the KeyPress event of the form.

--
HTH,
-- Tom Spink, über Geek

Please respond to the newsgroup,
so all can benefit

" System.Reflection Master "

==== Converting to 2002 ====
Remove inline declarations
"Woody Splawn" <wo***@splawns.com> wrote in message
news:uM*************@tk2msftngp13.phx.gbl...
我如何修复它当用户使用Alt-X时,
表单上的某个按钮会被触发?

另外,如何修复它以便在按下esc键时,表单是
关闭?
How do I fix it so that when the user preses Alt-X a certain button on the
form gets fired?

Also, How do I fix it so that when the esc key is pressed, the form is
closed?



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

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