2017-10-10 53 views

回答

1

刚才看了example in MSDN

 richTextBox1.SelectionFont = new Font("Lucinda Console", 12); 
     // Set the baseline text. 
     richTextBox1.SelectedText = "x"; 
     // Set the CharOffset to display superscript text. 
     richTextBox1.SelectionCharOffset = 10; 
     richTextBox1.SelectionFont = new Font("Lucinda Console", 8); 
     // Set the superscripted text. 
     richTextBox1.SelectedText = "2x"; 
     // Reset the CharOffset to display text at the baseline. 
     richTextBox1.SelectionCharOffset = 0; 
+2

** NB **设置SelectionFont时,您用于SelectionCharOffset的值将取决于字体大小。例如。如果你的字体大小是48点,SelectionCharOffset为10是不够的;你会想要更像44的东西。试试数字,直到你看到你想要的样子。 –