1. When you need to display superscripts or subscripts (for example, water's chemical formula H2O) in Silverlight, we can use special characters to display up and down targets specially handled by Silverlight.
Special characters of the superscript:
Superscript:
0: U+ 2070
1: U + 00b9
2: U + 00b2
3: U + 00b3
4-9: U + 2074-2079 (special characters from 4 to 9)
+: U + 207a
-: U + 207b
=: U + 207c
(: U + 207d
): U + 207e
N: U + 207f
Special characters of the following mark:
0-9: U + 2080-2089 (special characters from 0 to 9)
+: U + 208a
-: U + 208b
=: U + 208c
(: U + 208d
): U + 208e
In the preceding special characters, the content before the colon is what we want to display, and the special character after the colon is how to display in Silverlight;
In the code, u uses "\ x". For example, subscript 2 is represented by "\ x2082.
2. Use the following method:
When the chemical formula of water is displayed, the displayed string is: String water = "H" + "\ x2082" + "O ";
The actual string for displaying the stock theorem is: String S = "A \ x00b2 + B \ x00b2 = C \ x00b2 ";
The special character string "\ x2082" is displayed as the subscript 2, and the special character string "\ x00b2" is displayed as the subscript 2"
3. The display in the control is as follows:
<Textblock horizontalalignment = "Left" margin = "0" name = "MSG" text = "textblock" verticalalignment = "TOP"/>
Background code:
MSG. Text = "Fe \ x2082o \ x00b3"; (display the chemical formula of iron oxide)
Interface display effect: