How can I show an “&” (ampersand) in button or label text?

纵然是瞬间 提交于 2020-01-01 07:43:10

问题


I would like to show the & character, not the keyboard shortcut in the text property of a button or label.

Is there a way to do this?


回答1:


If you are trying to display & in button text, use &&. A single & is used for keyboard shortcuts, and a double ampersand will escape that.

The article Escape ampersand (&) character in C# mentions that you can leave the caption unaltered with single & and just set UseMnemonic property of the button to false.




回答2:


Try double & (&&). It works with VBA code.



来源:https://stackoverflow.com/questions/7601617/how-can-i-show-an-ampersand-in-button-or-label-text

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!