C# 如何在字符串中编写上标并使用 MessageBox.Show() 显示?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17704169/
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
How to write superscript in a string and display using MessageBox.Show()?
提问by Hazem Labeeb
I am trying to output the area using a message box, and it should be displayed as, for example, 256 unit^2...
我正在尝试使用消息框输出该区域,它应该显示为例如 256 unit^2 ...
How can I write a superscript (for powers) and a subscript (like O2 for oxygen)???
我怎样才能写上标(代表权力)和下标(如氧气代表氧气)???
This guy here adds a superscript like (TM):
这家伙在这里加了一个像(TM)这样的上标:
Adding a TM superScript to a string
I Hope I got myself clear! Thanks in advance and sorry for any inconvenience...
我希望我自己清楚!提前致谢,对于给您带来的不便,我们深表歉意...
采纳答案by p.s.w.g
You could try using unicode super/subscripts, for example:
您可以尝试使用unicode super/subscripts,例如:
var o2 = "O?"; // or "O\x2082"
var unit2 = "unit2"; // or "unit\xB2"
If that doesn't work, I'm afraid you'll probably need to to write your own message box.
如果这不起作用,恐怕您可能需要编写自己的消息框。