C# 在标签上显示刻度符号
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1221153/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Show tick symbol on label
提问by Timmi
How can I show "√" (tick symbol) in label text?
如何在标签文本中显示“√”(刻度符号)?
采纳答案by Sk93
This code will do it for you:
此代码将为您完成:
LblTick.Text = ((char)0x221A).ToString();
Edit:
编辑:
or even easier:
甚至更容易:
lblTick.Text = "\u221A";
Edit 2:
编辑2:
And, as pointed out in a comment, that code (221A) is actually a square root symbol, not a tick. To use the true tick mark, you can use the following:
而且,正如评论中指出的那样,代码(221A)实际上是一个平方根符号,而不是一个勾号。要使用真正的刻度线,您可以使用以下命令:
lblTick.Text = "\u2713";
or for a heavy tick mark, you can use the following (but you may get font issues with this one):
或者对于较重的刻度线,您可以使用以下内容(但您可能会遇到字体问题):
lblTick.Text = "\u2714";
(Credit to @Joey for that comment!)
(感谢@Joey 的评论!)
回答by nik
The Extended ASCII codefor that symbol is 251.
该符号的扩展 ASCII 码是 251。
You could probably also do,
你也可以这样做,
char c = '√';
Console.WriteLine("{0}", c);
回答by Max
This should work as well:
这也应该有效:
<asp:Label ID="Button1" runat="server" Text="√"></asp:Label>
回答by Hymanal
You can also use
你也可以使用
lblTick.Text="\u2714";