本文介绍了如何在Windows窗体中设置按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想设置按钮的快捷键,如保存,删除,更新等。如何在表单中设置它,所以请给我建议。

i want to set short key for button such as save,delete,update and so .how to set this in form so please give me suggestion.

推荐答案

Quote:

Text 属性设置为一个字符串,该字符串在作为访问键的字母前面包含一个&符号。例如,要将字母P设置为访问键,请在网格中键入& Print

set the Text property to a string that includes an ampersand before the letter that will be the access key. For example, to set the letter "P" as the access key, type "&Print" into the grid.



否则请通过 [],如果要根据需要分配密钥。


Otherwise go through Building Keyboard Accelerators into .NET Windows Forms Applications[^], if you want to assign keys according to your requirements.


if(e.Control == true && e.KeyData == Keys.S)
{
    btnSave_Click(sender,e);
}



这篇关于如何在Windows窗体中设置按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 13:31
查看更多