Can anybody help me for creating subscript and superscript in Richtextbox in c#. I am done in vb.net but could not convert it into c#.
here is my vb.net code...
Public Sub SetSubScript(ByRef rtb As System.Windows.Forms.RichTextBox)
Dim iPos As Integer
Dim strRTF As String
With rtb
If VB6.PixelsToTwipsX(.SelectionCharOffset) >= 0 Then
iPos = .SelectionStart
.SelectedText = Chr(128) & .SelectedText & Chr(129) ' \'80 \'81
strRTF = Replace(.Rtf, "\'80", "\sub\dn1 ")
.Rtf = Replace(strRTF, "\'81", "\nosupersub\up0 ")
'MessageBox .Show
.SelectionStart = iPos
Else
.SelectedText = Chr(128) & .SelectedText
strRTF = .Rtf
.Rtf = Replace(strRTF, "\'80", "\nosupersub\up0 ", , 1)
End If
End With
'rtb.Select()
End Sub