如何显示“&" (和号)在按钮或标签文本中? [英] How can I show an "&" (ampersand) in button or label text?
本文介绍了如何显示“&" (和号)在按钮或标签文本中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在按钮或标签的text属性中显示&
字符,而不显示不是键盘快捷键.
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?
推荐答案
如果要在按钮文本中显示&
,请使用&&
.单个&
用于键盘快捷键,而双&"号可以将其转义.
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
.
这篇关于如何显示“&" (和号)在按钮或标签文本中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文