How Silverlight display, enter the superscript and subscript?

This is a question I recently encountered problems for a long time on the Internet looking for a long time, finally solved this problem in the License Help

http://www.cnblogs.com/akwwl/archive/2012/08/12/2635614.html#2523515

Silverlight does not support keyboard input the subject up and down, up and down when the user enter standard information, how should I do it?

1. encountered need to display the superscript or subscript in Silverlight: when (as in Chemical Formula water H2O), we can use the vertical special target special character display processing in Silverlight.

On the subject of special characters:

Superscript:

0 : U + 2070

1 : U + 00B9

2 : U+00B2

3 : U+00B3

4-9 : + the U-2074-2079 (expressed from the special characters 4-9)

+ U + 207A

- U + 207B

= : U+207C

( U + 207D

) : U + 207E

n : U+207F

Under the subject of special characters:

0-9 : + the U-2080-2089 (from 0 to 9 represent special characters)

+ U + 208A

-: U+208B

=: U+208C

(: U+208D

): U+208E

More special characters in front of the colon for the content we want to display, after the colon is a special character in Silverlight how to display;

Where U is the code used in the "\ x", the subscript 2 is for example a "\ x2082" FIG.

2. Use as follows:

It shows the chemical formula of the water when the string is displayed: string water = "H" + "\ x2082" + "O";

Displaying the Pythagorean theorem, real string: string s = "a \ x00B2 + b \ x00B2 = c \ x00B2"; 

Wherein displaying the special character string as a subscript 2: "\ x2082", a special character string is displayed on a standard 2 "\ x00b2"

The display in the control as follows:

        <TextBlock  HorizontalAlignment="Left" Margin="0" Name="msg" Text="TextBlock" VerticalAlignment="Top" />

Background Code:

    msg.Text = "Fe \ x2082O \ x00B3"; (Display ferric oxide chemical formula) 

Screen display:

These are License blog, here add that, Silverlight does not support keyboard input the subject up and down, then when the user enters information is marked down, how should I do it?

Create a ListBox, and then add them up and down cursor to a List, and is bound to the ListBox

 The IList < String > List =  new new  List < String > (); 
 list.add ( "\ x2080" ); 
 list.add ( "\ x2081" );  
 list.add ( "\ x2082" ); 
 ...... .. 
 cmbType.ItemsSource = List; any bit up and down with this subject and then you can in the program by copying characters and you want to define the upper and lower standard string, and you can also string these upper and lower standard and stored in the database in

Reproduced in: https: //www.cnblogs.com/OnlyVersion/archive/2012/11/03/2752950.html

Guess you like

Origin blog.csdn.net/weixin_33862993/article/details/93293539