使他在屏幕上输出地时候实现 10的N次方 例如“m³”
label1.text="10^11" 貌似不行。
22 个解决方案
#1
<asp:Literal ID="li_test" runat="server"></asp:Literal>
li_test.Text = "m<sup>3</sup>";
li_test.Text = "m<sup>3</sup>";
#2
<asp:Label ID="li_test" runat="server"></asp:Label>
li_test.Text = "m<sup>3</sup>";
li_test.Text = "m<sup>3</sup>";
#3
label1.text = "m\xb3";
#4
label1.Text = "A¹ B² C³ D⁴ x⁵ x⁶ x⁷ x⁸ x⁹ xº Xⁿ"; // 直接写,不过不是很通用 :)
#5
我需要的是一个通用的方法
label1.text = "m\xb3" 是可以 但是
lable1.text=string.fromat("xxxxx 10\xb{0}",a);就不行了
有没有通用方法?
label1.text = "m\xb3" 是可以 但是
lable1.text=string.fromat("xxxxx 10\xb{0}",a);就不行了
有没有通用方法?
#6
0~9
SUPERSCRIPT ZERO x2070
SUPERSCRIPT ONE x00B9
SUPERSCRIPT TWO x00B2
SUPERSCRIPT THREE x00B3
SUPERSCRIPT FOUR x2074
SUPERSCRIPT FIVE x2075
SUPERSCRIPT SIX x2076
SUPERSCRIPT SEVEN x2077
SUPERSCRIPT EIGHT x2078
SUPERSCRIPT NINE x2079
#7
m^10就是
label1.Text = "m\xB9\x2070";
#8
学习中。。。
#9
那我的输出要是11不就不能解决了?
还有没有更好的方法呀
#10
有意思,估计楼主是要 做数学方面的软件哈!
#11
这个就是可以的
#12
汗,举一反三啊
m^11
label1.Text = "m\xB9\xB9";
#14
学习了···
#15
受教了 确实解决了 但代码要写不少 哎 !!!
#16
#17
using System;
using System.Windows.Forms;
class Form1 : Form
{
string Sup(int n)
{
string m = "\x2070\x00B9\x00B2\x00B3\x2074\x2075\x2076\x2077\x2078\x2079";
string s = n.ToString();
char[] c = new char[s.Length];
for (int i = 0; i < s.Length; i++)
c[i] = m[s[i] - '0'];
return new string(c);
}
Form1()
{
Label l = new Label();
l.Parent = this;
l.AutoSize = true;
l.Text = string.Format("6×10{0}, M{1}", Sup(23), Sup(11104));
}
static void Main()
{
Application.Run(new Form1());
}
}
#18
m<sub>3</sub>
#19
web上面好像是m<sub>3</sub>这样的样子,但winform呢?
#20
画个图片,够绝吧,哈哈
#21
谢谢空军的代码 我原先写成这样了:
string xDrptStr = "电 子 浓 度 (" + "10";
int exp10 = (int)Math.Truncate(exp / 10);
int exp1 = Convert.ToInt32(exp - 10 * exp10);
switch (exp10)
{
case 1:
xDrptStr += "\xb9";
break;
case 2:
xDrptStr += "\xb2";
break;
case 3:
xDrptStr += "\xb3";
break;
case 4:
xDrptStr += "\xb4";
break;
case 5:
xDrptStr += "\xb5";
break;
default:
break;
}
switch (exp1)
{
case 0:
xDrptStr += "\x2070";
break;
case 1:
xDrptStr += "\xb9";
break;
case 2:
xDrptStr += "\xb2";
break;
case 3:
xDrptStr += "\xb3";
break;
case 4:
xDrptStr += "\xb4";
break;
case 5:
xDrptStr += "\xb5";
break;
case 6:
xDrptStr += "\xb6";
break;
case 7:
xDrptStr += "\xb7";
break;
case 8:
xDrptStr += "\xb8";
break;
case 9:
xDrptStr += "\x2079";
break;
default:
break;
}
xDrptStr += "个/m³)";
#22
#1
<asp:Literal ID="li_test" runat="server"></asp:Literal>
li_test.Text = "m<sup>3</sup>";
li_test.Text = "m<sup>3</sup>";
#2
<asp:Label ID="li_test" runat="server"></asp:Label>
li_test.Text = "m<sup>3</sup>";
li_test.Text = "m<sup>3</sup>";
#3
label1.text = "m\xb3";
#4
label1.Text = "A¹ B² C³ D⁴ x⁵ x⁶ x⁷ x⁸ x⁹ xº Xⁿ"; // 直接写,不过不是很通用 :)
#5
我需要的是一个通用的方法
label1.text = "m\xb3" 是可以 但是
lable1.text=string.fromat("xxxxx 10\xb{0}",a);就不行了
有没有通用方法?
label1.text = "m\xb3" 是可以 但是
lable1.text=string.fromat("xxxxx 10\xb{0}",a);就不行了
有没有通用方法?
#6
0~9
SUPERSCRIPT ZERO x2070
SUPERSCRIPT ONE x00B9
SUPERSCRIPT TWO x00B2
SUPERSCRIPT THREE x00B3
SUPERSCRIPT FOUR x2074
SUPERSCRIPT FIVE x2075
SUPERSCRIPT SIX x2076
SUPERSCRIPT SEVEN x2077
SUPERSCRIPT EIGHT x2078
SUPERSCRIPT NINE x2079
#7
m^10就是
label1.Text = "m\xB9\x2070";
#8
学习中。。。
#9
那我的输出要是11不就不能解决了?
还有没有更好的方法呀
#10
有意思,估计楼主是要 做数学方面的软件哈!
#11
这个就是可以的
#12
汗,举一反三啊
m^11
label1.Text = "m\xB9\xB9";
#13
#14
学习了···
#15
受教了 确实解决了 但代码要写不少 哎 !!!
#16
#17
using System;
using System.Windows.Forms;
class Form1 : Form
{
string Sup(int n)
{
string m = "\x2070\x00B9\x00B2\x00B3\x2074\x2075\x2076\x2077\x2078\x2079";
string s = n.ToString();
char[] c = new char[s.Length];
for (int i = 0; i < s.Length; i++)
c[i] = m[s[i] - '0'];
return new string(c);
}
Form1()
{
Label l = new Label();
l.Parent = this;
l.AutoSize = true;
l.Text = string.Format("6×10{0}, M{1}", Sup(23), Sup(11104));
}
static void Main()
{
Application.Run(new Form1());
}
}
#18
m<sub>3</sub>
#19
web上面好像是m<sub>3</sub>这样的样子,但winform呢?
#20
画个图片,够绝吧,哈哈
#21
谢谢空军的代码 我原先写成这样了:
string xDrptStr = "电 子 浓 度 (" + "10";
int exp10 = (int)Math.Truncate(exp / 10);
int exp1 = Convert.ToInt32(exp - 10 * exp10);
switch (exp10)
{
case 1:
xDrptStr += "\xb9";
break;
case 2:
xDrptStr += "\xb2";
break;
case 3:
xDrptStr += "\xb3";
break;
case 4:
xDrptStr += "\xb4";
break;
case 5:
xDrptStr += "\xb5";
break;
default:
break;
}
switch (exp1)
{
case 0:
xDrptStr += "\x2070";
break;
case 1:
xDrptStr += "\xb9";
break;
case 2:
xDrptStr += "\xb2";
break;
case 3:
xDrptStr += "\xb3";
break;
case 4:
xDrptStr += "\xb4";
break;
case 5:
xDrptStr += "\xb5";
break;
case 6:
xDrptStr += "\xb6";
break;
case 7:
xDrptStr += "\xb7";
break;
case 8:
xDrptStr += "\xb8";
break;
case 9:
xDrptStr += "\x2079";
break;
default:
break;
}
xDrptStr += "个/m³)";