如何让'&'在MenuItem中显示为文本

时间:2022-10-04 19:42:56

I want to have a MenuItem with the Text property set to "Tom & Jerry" but, as you all know, the '&' before a character tells Windows that the next character is the keyboard shortcut.

我希望有一个MenuItem,Text属性设置为“Tom&Jerry”但是,众所周知,字符前面的'&'告诉Windows下一个字符是键盘快捷键。

So how does one escape the '&' to show up as text in the MenuItem?

那么如何逃避'&'以在MenuItem中显示为文本?

2 个解决方案

#1


You can use a double, &&, but it will be underscored.

您可以使用double,&&,但会强调它。

Just tested (Wm 6.1 emulator), and TheTXI had the right guess: 4 ampersands, &&&& did finally show up as 1 single. Wonder who thought that up. Will try it on my HTC Touch next.

刚测试过(Wm 6.1模拟器),TheTXI有正确的猜测:4个&符号,&&&&最终显示为1个单曲。奇迹谁想到了。接下来会在我的HTC Touch上试试。

Confirmed, my Device and the emulator agree. But the Designer can't be trusted.

确认,我的设备和模拟器同意。但设计师不可信任。

#2


I tried the &&, it workd and it wasn't underlined.

我尝试了&&,它工作,并没有下划线。

#1


You can use a double, &&, but it will be underscored.

您可以使用double,&&,但会强调它。

Just tested (Wm 6.1 emulator), and TheTXI had the right guess: 4 ampersands, &&&& did finally show up as 1 single. Wonder who thought that up. Will try it on my HTC Touch next.

刚测试过(Wm 6.1模拟器),TheTXI有正确的猜测:4个&符号,&&&&最终显示为1个单曲。奇迹谁想到了。接下来会在我的HTC Touch上试试。

Confirmed, my Device and the emulator agree. But the Designer can't be trusted.

确认,我的设备和模拟器同意。但设计师不可信任。

#2


I tried the &&, it workd and it wasn't underlined.

我尝试了&&,它工作,并没有下划线。