Enter]键;&安培;"符号到Windows窗体的文本标签? [英] Enter "&" symbol into a text Label in Windows Forms?

查看:265
本文介绍了Enter]键;&安培;"符号到Windows窗体的文本标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将一个输入特殊字符到在C#中(Windows窗体)一个标签

How would one enter special characters into a Label in C# (Windows Forms)?

如果您尝试写了一个&放大器;成一个标签,你会得到一种下划线代替。

If you try to write a "&" into a label you'll get a sort of underscore instead..

那么什么是C#相当于&放大器;? (\&安培;显然是行不通的)

So what's the C# equivalent of "&"? ("\&" obviously doesn't work).

推荐答案

有两种方式:

  • 与其他符号转义。(&功放;&安培;

设置<一href="http://msdn.microsoft.com/en-us/library/system.windows.forms.label.usemnemonic.aspx"><$c$c>UseMnemonic对于标签。这将导致文本中的所有&号将要采取字面,所以你并不需要双倍任何人。你将失去下划线并访问主要功能虽然。

Set UseMnemonic for that label to false. This causes all ampersands within the text to be taken literally so you don't need to double any of them. You'll lose the underlining and access key features though.

您可以设置在设计师的价值无论是,还是在code:

You can set the value either in the designer, or in code:

myLabel.UseMnemonic = false;
myLabel.Text = "Text&Text";

这篇关于Enter]键;&安培;&QUOT;符号到Windows窗体的文本标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆