# Defining Subscript and Superscript

• ### Question

• When you are setting font details such as font name, style etc what do I need to do make an X followed by either a subscript or superscript? I know when defining a new font using fontstlyes I can set bold, strikeout etc but there is no mention for the subscripts or superscripts.

Les

Saturday, September 15, 2018 5:51 AM

•  Actually you can display subscrip or superscript in any control,  Label,  TextBox,  RichTextBox,  or even in the Paint event.  You just need to open the windows (Character Map),  search and select a font that you like and has the sub and super script characters you want.  For example,  I selected the 'Segoe UI' font and found the hexadecimal value for sub and super script numbers 0 through 9.

Notice in the image below that the value for the SuperScript 0 shows 'U+2070'.  You can declare that in your VB code by using the hexadecimal indicator &H.  I declared these values in two enumerations but,  you can declare them individually if you want.  If you look in my SuperScript enum,  you see the value of n0 is '&H2070'.  You basically just replace the 'U+' with '&H'.  Then you can use these characters in your controls using the ChrW method to get the unicode characters.

This is the Windows Character Map window...

Here is an example of setting the controls Fonts to 'Segoe UI' and adding the unicode characters to show sub and super script in the text,  plus painting it too.

Public Class Form1
Private MySubAndSuperScriptString As String = ""
Private MyFont12 As New Font("Segoe UI", 12, FontStyle.Bold)
Private MyFont8 As New Font("Segoe UI", 8.75, FontStyle.Regular)

'Using the (Segoe UI) font, this string will display (X²  X₅)
MySubAndSuperScriptString = "X" & ChrW(SuperScript.n2) & "   X" & ChrW(SubScript.n5)

Label1.Font = MyFont8
Label1.Text = MySubAndSuperScriptString

TextBox1.Font = MyFont8
TextBox1.Text = MySubAndSuperScriptString

RichTextBox1.Font = MyFont12
RichTextBox1.Text = MySubAndSuperScriptString
End Sub

Private Sub Form1_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint
e.Graphics.DrawString(MySubAndSuperScriptString, MyFont12, Brushes.Black, 12, 12)
End Sub
End Class

Public Enum SuperScript As Integer
n0 = &H2070
n1 = &HB9
n2 = &HB2
n3 = &HB3
n4 = &H2074
n5 = &H2075
n6 = &H2076
n7 = &H2077
n8 = &H2078
n9 = &H2079
End Enum

Public Enum SubScript As Integer
n0 = &H2080
n1 = &H2081
n2 = &H2082
n3 = &H2083
n4 = &H2084
n5 = &H2085
n6 = &H2086
n7 = &H2087
n8 = &H2088
n9 = &H2089
End Enum

Here you can see the result of the example above...

PS - You can also just copy the characters from the Character Map window and paste them into a string in your code.  Then just append/insert the string into your Text when needed.

If you say it cant be done then ill try it

• Edited by Sunday, September 16, 2018 7:09 PM
• Marked as answer by Monday, September 17, 2018 2:26 PM
Sunday, September 16, 2018 6:28 PM
• Les,

The sub and super scripts are only supported in a RichTextBox control. There are several good examples if you search. But the richtext is a bit more complex than a basic textbox that uses a basic string.

When you draw your own text with gdi+ and drawstring etc you will have to make your own as you did in your equations when you just add like half the fontheight to the drawing coordinates. Then you have to parse the strings so you find the symbols you want to offset up or down and make special routine for drawing your strings with sub and super scripts from strings.

There are some fonts that have a few math symbols that have a few built in like the symbols and wingdings fonts etc.

PS This article has a class you can use to draw rich text format onto a picturebox or other graphics surface. If you want to do it that way you have to create the rtf string which is not simple. But, you can add sub script and super script as well as other.

https://support.microsoft.com/EN-US/help/811401

• Edited by Sunday, September 16, 2018 3:47 PM
• Marked as answer by Sunday, September 16, 2018 4:29 PM
Sunday, September 16, 2018 12:29 PM
• Hi IR,

Yes I am familiar with the character maps for some reason I didn't catch that.  BTW keep in mind I have not looked yet I plan on doing that tonight but do you think I could also get a negative sign in front of the superscripts? I don't need negatives for the subscripts, just curious.

Les

Sorry,  I missed this question yesterday.  Yes you can use whatever characters are shown in the character map for the selected Font.  Just add the values for the sub/super script minus character,  or whatever characters to the enumerations.  For example...

Public Class Form1
Private MySubAndSuperScriptString As String = ""
Private MyFont12 As New Font("Segoe UI", 12, FontStyle.Bold)
Private MyFont8 As New Font("Segoe UI", 8.75, FontStyle.Regular)

MySubAndSuperScriptString = "X" & ChrW(SuperScript.Minus) & ChrW(SuperScript.n2) & "   X" & ChrW(SubScript.n5)

Label1.Font = MyFont8
Label1.Text = MySubAndSuperScriptString

TextBox1.Font = MyFont8
TextBox1.Text = MySubAndSuperScriptString

RichTextBox1.Font = MyFont12
RichTextBox1.Text = MySubAndSuperScriptString
End Sub

Private Sub Form1_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint
e.Graphics.DrawString(MySubAndSuperScriptString, MyFont12, Brushes.Black, 12, 12)
End Sub
End Class

Public Enum SuperScript As Integer
n0 = &H2070
n1 = &HB9
n2 = &HB2
n3 = &HB3
n4 = &H2074
n5 = &H2075
n6 = &H2076
n7 = &H2077
n8 = &H2078
n9 = &H2079

Plus = &H207A
Minus = &H207B
Equal = &H207C
LeftParenthesis = &H207D
RightParenthesis = &H207E
End Enum

Public Enum SubScript As Integer
n0 = &H2080
n1 = &H2081
n2 = &H2082
n3 = &H2083
n4 = &H2084
n5 = &H2085
n6 = &H2086
n7 = &H2087
n8 = &H2088
n9 = &H2089

Plus = &H208A
Minus = &H208B
Equal = &H208C
LeftParenthesis = &H208D
RightParenthesis = &H208E
End Enum

Now there is a -2 superscript after the first X.

If you say it cant be done then ill try it

• Marked as answer by Monday, September 17, 2018 2:25 PM
Monday, September 17, 2018 10:36 AM

### All replies

• Les,

The sub and super scripts are only supported in a RichTextBox control. There are several good examples if you search. But the richtext is a bit more complex than a basic textbox that uses a basic string.

When you draw your own text with gdi+ and drawstring etc you will have to make your own as you did in your equations when you just add like half the fontheight to the drawing coordinates. Then you have to parse the strings so you find the symbols you want to offset up or down and make special routine for drawing your strings with sub and super scripts from strings.

There are some fonts that have a few math symbols that have a few built in like the symbols and wingdings fonts etc.

PS This article has a class you can use to draw rich text format onto a picturebox or other graphics surface. If you want to do it that way you have to create the rtf string which is not simple. But, you can add sub script and super script as well as other.

https://support.microsoft.com/EN-US/help/811401

• Edited by Sunday, September 16, 2018 3:47 PM
• Marked as answer by Sunday, September 16, 2018 4:29 PM
Sunday, September 16, 2018 12:29 PM
• Hi Tom,

Thank you very much for your valued input, I figured when nobody was getting back to my post was a scary sign<S>.  I understand what you said and will work on developing some routines to handle it.  I am familiar with richtextboxes and like you said I would rather develop my own routines then the alternative.

Take care Tom and thanks,

Les

Sunday, September 16, 2018 4:29 PM
• Hi Tom,

Thank you very much for your valued input, I figured when nobody was getting back to my post was a scary sign<S>.  I understand what you said and will work on developing some routines to handle it.  I am familiar with richtextboxes and like you said I would rather develop my own routines then the alternative.

Take care Tom and thanks,

Les

You are welcome.

I was hoping for something easier too. Which there could still be some other ways?

Since you seem interested in rich text format (rtf) here is an example I started on using that article from my previous post.

The form has an richtextbox (top), picturebox (bottom) and print button that is made in the code as shown.

There is a routine to draw the rtf file on a picturebox or click the button to print (click the print button on the print preview to print). The rtb has the rtf format file in an richtextbox control. The lower image is a picture box drawn using the special RichTextBoxPrintCtrl class from the article.

So you can make rtf strings as files saved in MS word as .RTF files and then draw them using the class but instead of printing from the article you use the draw on picture box way as shown. Or even just generate rtf from code if you really get into rtf.

'print and draw rtb two columns multiple pages
Option Strict On
Imports System.Runtime.InteropServices
Imports System.Drawing.Printing
Public Class Form1'make the controls
Private WithEvents RichTextBoxPrintCtrl1 As New RichTextBoxPrintCtrl With {.Parent = Me,
.Size = New Size(450, 100), .Location = New Point(10, 40)}
Private WithEvents Picturebox1 As New PictureBox With {.Parent = Me,
.Size = New Size(450, 900), .Location = New Point(10, 160), .BackColor = Color.White}
Private WithEvents Button1 As New Button With {.Parent = Me,
.Location = New Point(30, 10), .Text = "Print"}
Private WithEvents PrintDocument1 As PrintDocument = New PrintDocument
Private PrintPreviewDialog1 As New PrintPreviewDialog
Private checkPrint As Integer

ClientSize = New Size(500, 1000)'use your rtf format file in the rtb control.
Picturebox1.Invalidate()
End Sub

Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
' Print the content of the RichTextBox. Store the last character printed.
checkPrint = RichTextBoxPrintCtrl1.Print(checkPrint, RichTextBoxPrintCtrl1.TextLength, e)

' Look for more pages
If checkPrint < RichTextBoxPrintCtrl1.TextLength Then
e.HasMorePages = True
Else
e.HasMorePages = False
End If
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
PrintPreviewDialog1.Document = PrintDocument1
PrintPreviewDialog1.ShowDialog()

Catch ex As Exception
MsgBox("Problem Printing:" & Chr(13) & ex.Message, MsgBoxStyle.Exclamation)
End Try

checkPrint = 0
End Sub

Private Sub Picturebox1_Paint(sender As Object, e As PaintEventArgs) Handles Picturebox1.Paint

'convert to 100th inch
Dim r As Single = 100 / e.Graphics.DpiX
Dim marg As Single = CInt(r * 20)

'Dim pageRect As Rectangle = Picturebox1.ClientRectangle
Dim pageRect As Rectangle = New Rectangle(CInt(r * Picturebox1.ClientRectangle.Left),
CInt(r * Picturebox1.ClientRectangle.Top),
CInt(r * Picturebox1.ClientRectangle.Width),
CInt(r * Picturebox1.ClientRectangle.Height))

'Dim marginRect As Rectangle = New Rectangle(pageRect.Left + marg, pageRect.Top + marg, pageRect.Width - (2 * marg), pageRect.Height - (2 * marg))
Dim marginRect As Rectangle = New Rectangle(CInt(pageRect.Left + marg),
CInt(pageRect.Top + marg),
CInt(pageRect.Width - (2 * marg)),
CInt(pageRect.Height - (2 * marg)))

Dim thisCharFrom As Integer = RichTextBoxPrintCtrl1.DrawRtb(checkPrint, RichTextBoxPrintCtrl1.TextLength, e.Graphics, pageRect, marginRect)

End Sub
End Class

Public Class RichTextBoxPrintCtrl
'https://support.microsoft.com/en-us/help/811401/how-to-print-the-content-of-a-richtextbox-control-by-using-visual-basic-.net-or-visual-basic-2005

Inherits RichTextBox
' Convert the unit that is used by the .NET framework (1/100 inch)
' and the unit that is used by Win32 API calls (twips 1/1440 inch)
Private Const AnInch As Double = 14.4

<StructLayout(LayoutKind.Sequential)>
Private Structure RECT
Public Left As Integer
Public Top As Integer
Public Right As Integer
Public Bottom As Integer
End Structure

<StructLayout(LayoutKind.Sequential)>
Private Structure CHARRANGE
Public cpMin As Integer          ' First character of range (0 for start of doc)
Public cpMax As Integer          ' Last character of range (-1 for end of doc)
End Structure

<StructLayout(LayoutKind.Sequential)>
Private Structure FORMATRANGE
Public hdc As IntPtr             ' Actual DC to draw on
Public hdcTarget As IntPtr       ' Target DC for determining text formatting
Public rc As RECT                ' Region of the DC to draw to (in twips)
Public rcPage As RECT            ' Region of the whole DC (page size) (in twips)
Public chrg As CHARRANGE         ' Range of text to draw (see above declaration)
End Structure

Private Const WM_USER As Integer = &H400
Private Const EM_FORMATRANGE As Integer = WM_USER + 57
Private Declare Function SendMessage Lib "USER32" Alias "SendMessageA" (ByVal hWnd As IntPtr, ByVal msg As Integer, ByVal wp As IntPtr, ByVal lp As IntPtr) As IntPtr

' Render the contents of the RichTextBox for printing
'Return the last character printed + 1 (printing start from this point for next page)
Public Function Print(ByVal charFrom As Integer, ByVal charTo As Integer, ByVal e As PrintPageEventArgs) As Integer

Dim thisCharFrom As Integer = DrawRtb(charFrom, charTo, e.Graphics, e.PageBounds, e.MarginBounds)
Return thisCharFrom

End Function

Public Function DrawRtb(ByVal charFrom As Integer, ByVal charTo As Integer,
ByVal g As Graphics, ByVal pageRectangle As Rectangle, marginRectangle As Rectangle) As Integer
' Mark starting and ending character
Dim cRange As CHARRANGE
cRange.cpMin = charFrom
cRange.cpMax = charTo

' Calculate the area to render and print
Dim rectToPrint As RECT
Dim rectPage As RECT
Dim hdc As IntPtr = g.GetHdc()
Dim fmtRange As FORMATRANGE
Dim res As IntPtr
Dim wparam As IntPtr = IntPtr.Zero
Dim lparam As IntPtr = IntPtr.Zero
rectToPrint.Top = CInt(marginRectangle.Top * AnInch)
rectToPrint.Bottom = CInt(marginRectangle.Bottom * AnInch)

' Calculate the size of the page
rectPage.Top = CInt(pageRectangle.Top * AnInch)
rectPage.Bottom = CInt(pageRectangle.Bottom * AnInch)
rectPage.Left = CInt(pageRectangle.Left * AnInch)
rectPage.Right = CInt(pageRectangle.Right * AnInch)

Dim marginWidth As Integer = marginRectangle.Left
'Dim columnWidth As Integer = CInt((marginRectangle.Width - marginWidth) / 2)
Dim columnWidth As Integer = CInt((marginRectangle.Width - marginWidth) / 2)
Dim r1 As Integer

'draw two columns
For i As Integer = 0 To 1
r1 = CInt((marginWidth + (marginWidth * i) + (columnWidth * i)) * AnInch)
rectToPrint.Left = r1
rectToPrint.Right = CInt(rectToPrint.Left + (columnWidth * AnInch))

fmtRange.chrg = cRange                 ' Indicate character from to character to
fmtRange.hdc = hdc                     ' Use the same DC for measuring and rendering
fmtRange.hdcTarget = hdc               ' Point at printer hDC
fmtRange.rc = rectToPrint              ' Indicate the area on page to print
fmtRange.rcPage = rectPage             ' Indicate whole size of page

res = IntPtr.Zero

'wparam = IntPtr.Zero
wparam = New IntPtr(1)

' Move the pointer to the FORMATRANGE structure in memory
'lparam = IntPtr.Zero
Marshal.StructureToPtr(fmtRange, lparam, False)

' Send the rendered data for printing
res = SendMessage(Handle, EM_FORMATRANGE, wparam, lparam)

' Free the block of memory allocated

'check length of text left to print
If i = 0 AndAlso charFrom < charTo Then
'print second column
charFrom = res.ToInt32()
cRange.cpMin = charFrom
End If
Next

g.ReleaseHdc(hdc)

' Return last + 1 character printer
Return res.ToInt32()

End Function
End Class



Sunday, September 16, 2018 4:54 PM
•  Actually you can display subscrip or superscript in any control,  Label,  TextBox,  RichTextBox,  or even in the Paint event.  You just need to open the windows (Character Map),  search and select a font that you like and has the sub and super script characters you want.  For example,  I selected the 'Segoe UI' font and found the hexadecimal value for sub and super script numbers 0 through 9.

Notice in the image below that the value for the SuperScript 0 shows 'U+2070'.  You can declare that in your VB code by using the hexadecimal indicator &H.  I declared these values in two enumerations but,  you can declare them individually if you want.  If you look in my SuperScript enum,  you see the value of n0 is '&H2070'.  You basically just replace the 'U+' with '&H'.  Then you can use these characters in your controls using the ChrW method to get the unicode characters.

This is the Windows Character Map window...

Here is an example of setting the controls Fonts to 'Segoe UI' and adding the unicode characters to show sub and super script in the text,  plus painting it too.

Public Class Form1
Private MySubAndSuperScriptString As String = ""
Private MyFont12 As New Font("Segoe UI", 12, FontStyle.Bold)
Private MyFont8 As New Font("Segoe UI", 8.75, FontStyle.Regular)

'Using the (Segoe UI) font, this string will display (X²  X₅)
MySubAndSuperScriptString = "X" & ChrW(SuperScript.n2) & "   X" & ChrW(SubScript.n5)

Label1.Font = MyFont8
Label1.Text = MySubAndSuperScriptString

TextBox1.Font = MyFont8
TextBox1.Text = MySubAndSuperScriptString

RichTextBox1.Font = MyFont12
RichTextBox1.Text = MySubAndSuperScriptString
End Sub

Private Sub Form1_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint
e.Graphics.DrawString(MySubAndSuperScriptString, MyFont12, Brushes.Black, 12, 12)
End Sub
End Class

Public Enum SuperScript As Integer
n0 = &H2070
n1 = &HB9
n2 = &HB2
n3 = &HB3
n4 = &H2074
n5 = &H2075
n6 = &H2076
n7 = &H2077
n8 = &H2078
n9 = &H2079
End Enum

Public Enum SubScript As Integer
n0 = &H2080
n1 = &H2081
n2 = &H2082
n3 = &H2083
n4 = &H2084
n5 = &H2085
n6 = &H2086
n7 = &H2087
n8 = &H2088
n9 = &H2089
End Enum

Here you can see the result of the example above...

PS - You can also just copy the characters from the Character Map window and paste them into a string in your code.  Then just append/insert the string into your Text when needed.

If you say it cant be done then ill try it

• Edited by Sunday, September 16, 2018 7:09 PM
• Marked as answer by Monday, September 17, 2018 2:26 PM
Sunday, September 16, 2018 6:28 PM
• Hi IR,

Interesting was not aware of that font set.  I will try this later.

Thanks

Les

Sunday, September 16, 2018 6:49 PM
• Hey Tommy,

IR just replied to my post and had an interesting method, I have not tried it yet but I think it should work.

Just an FYI,

Thanks

Les

Sunday, September 16, 2018 6:51 PM
• Hi IR,

Interesting was not aware of that font set.  I will try this later.

Thanks

Les

If you open the Character Map,  you can look through the fonts and the unicode characters they have,  Segoe UI  is not the only font that contains them.  As I said,  you just need to find the font that contains the sub/super script characters you want,  and that you like the looks of.  8)

If you say it cant be done then ill try it

Sunday, September 16, 2018 7:05 PM
• Hi IR,

Yes I am familiar with the character maps for some reason I didn't catch that.  BTW keep in mind I have not looked yet I plan on doing that tonight but do you think I could also get a negative sign in front of the superscripts? I don't need negatives for the subscripts, just curious.

Les

Sunday, September 16, 2018 7:26 PM
• Hey Tommy,

IR just replied to my post and had an interesting method, I have not tried it yet but I think it should work.

Just an FYI,

Thanks

Les

Yes that is what I meant that some fonts have chars that are scripted already and various other math symbols like the symbols font. However these are specific chars and not all fonts have them. Correct Razerz?  Or maybe you want the letter f or pi symbol in the super script etc. So thats font based and maybe that's what you should do. I think you can get fonts that have math symbols of all kinds etc.

If I understand you can use the offset property with richtext to move any char in a font by the spec'd amount. So say its wingding22 or (pi *4), you can script any chr by the amount you choose. Not that I have done it. And the rtf version is rtf so it could go into other things. If you need some way to indicate this is a sub script or whatever that is built into rtf for any chr.

PS (its like font bold you turn it on and it stays on??? is that how it works?)

So it just depends on what you are doing exactly. If you can do it the Razerz way that will be easiest I think.

PS Plus you may want to scale the symbol ie the superscript is half the size of the other chrs. I am not sure what does that?

Sunday, September 16, 2018 7:28 PM
• Hi Tom,

I just want to say that you appear very knowledgeable when it comes to graphics!!  You and Reed really have a good understanding as to what can be done with VB.  Tonight I will see if I can include a minus sign with the super and sub scripts.  As you know there is always a way just depends how difficult it gets <S>.

Thanks

Les

Sunday, September 16, 2018 7:34 PM
• Hi Tom,

I just want to say that you appear very knowledgeable when it comes to graphics!!  You and Reed really have a good understanding as to what can be done with VB.  Tonight I will see if I can include a minus sign with the super and sub scripts.  As you know there is always a way just depends how difficult it gets <S>.

Thanks

Les

Yes well Razerz and Reed taught me so like I say I was hoping there was an easier way. Also we throw them out there as alternates and try to help you decide as we don't know exactly what you want.

:)

Sunday, September 16, 2018 7:40 PM
• Hey Tommy,

IR just replied to my post and had an interesting method, I have not tried it yet but I think it should work.

Just an FYI,

Thanks

Les

Yes that is what I meant that some fonts have chars that are scripted already and various other math symbols like the symbols font. However these are specific chars and not all fonts have them. Correct Razerz?  Or maybe you want the letter f or pi symbol in the super script etc. So thats font based and maybe that's what you should do. I think you can get fonts that have math symbols of all kinds etc.

If I understand you can use the offset property with richtext to move any char in a font by the spec'd amount. So say its wingding22 or (pi *4), you can script any chr by the amount you choose. Not that I have done it. And the rtf version is rtf so it could go into other things. If you need some way to indicate this is a sub script or whatever that is built into rtf for any chr.

PS (its like font bold you turn it on and it stays on??? is that how it works?)

So it just depends on what you are doing exactly. If you can do it the Razerz way that will be easiest I think.

Hi Tom,

No,  not every font would have all the same characters.

Yes,  in a RichTextBox you also have the option of using the RichTextBox's SelectionCharOffset property to move specific characters up or down.  For example,  I move the '1' up and the '4' down in the  '1/4' part of the text...

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
RichTextBox1.Text = "This is  1/4  of the work."
RichTextBox1.Find("1")
RichTextBox1.SelectionCharOffset = 8 'sets selected character as superscript. Range from 1 to 2000
RichTextBox1.Find("4")
RichTextBox1.SelectionCharOffset = -8 'sets selected character as subscript. Ranges from -1 to -2000
RichTextBox1.Select(0, 0)
End Sub


If you say it cant be done then ill try it

Sunday, September 16, 2018 8:27 PM
• Hi IR,

Yes I am familiar with the character maps for some reason I didn't catch that.  BTW keep in mind I have not looked yet I plan on doing that tonight but do you think I could also get a negative sign in front of the superscripts? I don't need negatives for the subscripts, just curious.

Les

Sorry,  I missed this question yesterday.  Yes you can use whatever characters are shown in the character map for the selected Font.  Just add the values for the sub/super script minus character,  or whatever characters to the enumerations.  For example...

Public Class Form1
Private MySubAndSuperScriptString As String = ""
Private MyFont12 As New Font("Segoe UI", 12, FontStyle.Bold)
Private MyFont8 As New Font("Segoe UI", 8.75, FontStyle.Regular)

MySubAndSuperScriptString = "X" & ChrW(SuperScript.Minus) & ChrW(SuperScript.n2) & "   X" & ChrW(SubScript.n5)

Label1.Font = MyFont8
Label1.Text = MySubAndSuperScriptString

TextBox1.Font = MyFont8
TextBox1.Text = MySubAndSuperScriptString

RichTextBox1.Font = MyFont12
RichTextBox1.Text = MySubAndSuperScriptString
End Sub

Private Sub Form1_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint
e.Graphics.DrawString(MySubAndSuperScriptString, MyFont12, Brushes.Black, 12, 12)
End Sub
End Class

Public Enum SuperScript As Integer
n0 = &H2070
n1 = &HB9
n2 = &HB2
n3 = &HB3
n4 = &H2074
n5 = &H2075
n6 = &H2076
n7 = &H2077
n8 = &H2078
n9 = &H2079

Plus = &H207A
Minus = &H207B
Equal = &H207C
LeftParenthesis = &H207D
RightParenthesis = &H207E
End Enum

Public Enum SubScript As Integer
n0 = &H2080
n1 = &H2081
n2 = &H2082
n3 = &H2083
n4 = &H2084
n5 = &H2085
n6 = &H2086
n7 = &H2087
n8 = &H2088
n9 = &H2089

Plus = &H208A
Minus = &H208B
Equal = &H208C
LeftParenthesis = &H208D
RightParenthesis = &H208E
End Enum

Now there is a -2 superscript after the first X.

If you say it cant be done then ill try it

• Marked as answer by Monday, September 17, 2018 2:25 PM
Monday, September 17, 2018 10:36 AM
• Cool thanks IR

Les

Monday, September 17, 2018 2:25 PM