如何制作一个按钮的快捷方式..像Alt + F4 [英] How to make short cuts of a button.. like Alt + F4

查看:99
本文介绍了如何制作一个按钮的快捷方式..像Alt + F4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何制作按钮的快捷方式.例如Alt + F4,以及如何在不更改菜单提示项和所有内容的情况下将表单加载到特定区域..
例如,如果我们构建一个在工具栏上具有按钮的应用程序,则说每个按钮都会打开一个新表单,但工具栏上的按钮不会更改.

解决方案

对于常规按钮,最简单的方法是在要使用的字符之前立即在文本属性中添加一个&字符:

 myButton.Text = " ; 

当用户按下ALT + P时,该按钮将被激活.

这也适用于标签:它们将激活Tab Order中的下一个控件,因此带有文本
的标签

 myLabel.Text = " ; 将在其后激活该文本框.


好吧,我已经知道了.我不能为此目的使用F4或其他键(例如dat).


希望有帮助的

如果(e.KeyCode == Keys.F4)
{
button1_Click(sender,null);
}


How to make short cuts of a button.. like Alt + F4 and also how to make a form load into an specific area without changing the menustip items and all..
like if we build an application having buttons on the toolstrip, say each button opens a new form but the buttons on the toolstrip doesnt change.

解决方案

With regular buttons, the easiest way is to add an ampersand character to the Text property, immediately before the character you want to use:

myButton.Text = "Hel&p";

When the user presses ALT+P, the button will be activated.

This also works with labels: they will activate the next control in the Tab Order , so a label with the text

myLabel.Text = "&User Name:";

will activate the textbox after it when ALT+U is pressed.


Well with due respect it was known to me. Can''t I use F4 or other keys like dat for the purpose.


Hope that helps

if (e.KeyCode == Keys.F4)
{
button1_Click(sender, null);
}


这篇关于如何制作一个按钮的快捷方式..像Alt + F4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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