在c#中用&符号传递控件文本有什么区别?

问题描述:

this.button1.text = "&Close";
this.button1.text = "Close";





两者都会动态显示文本为Close,那么传递&符号的用途是什么。



Both will display the text dynamically as Close, then what is the use of passing ampersand .

this.button1.text =& Close;

将强调C字与文本。它用于热键(快捷键,如果我没记错的话。你可以谷歌吧。)



this.button1.text =关闭;

只会分配文字。



-KR
this.button1.text = "&Close";
will underline the C word with the text. It's used for hotkeys (short cut keys, if I recall correctly. You can google for it.)

this.button1.text = "Close";
will simply assign the text.

-KR