谢谢dof的热心,其实代码很简单:以下是VB .net 代码
添加一个TextControl1控件和TextBox1控件:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextControl1.Selection.Text = "226.2mm"
TextControl1.InputFormat.Superscript = True ‘设置上标开始
TextControl1.Selection.Text = "2"
TextControl1.InputFormat.Superscript = False ‘设置上标结束
Dim s As String = ""
TextControl1.Selection.Save(s, TXTextControl.StringStreamType.RichTextFormat) ’将带格式的文本保存到字符串s
TextBox1.Text = s ’显示带格式的文本
End Sub |