Question: How to making text italic and superscripted

  • Thread starter Christian O'Connell
  • Start date
C

Christian O'Connell

Hello - apologies if this has been asked before and already answered.
This is my first question and I have already unsuccessfully searched
Google groups and the on-line help files for the answer.

Here is what I am doing.

I am modifying a largish VB.Net program to make text appear, in the
quadratic equation, from

0=aX2+bx+c

to:

2
0=aX +bx+c

ie, the 2 is to be superscripted. And I also need to italise the X's.

I can see how to individually italicise a complete string, but not
just parts (that is just the X's). So how is this done (to both make
the 2 superscripted and italicise the X's)?

Here is a code snippet from the application (to get this to work paste
into Form1). I am wanting to somehow still use g.DrawString, if at all
possible because there is a lot of code to modify, but am not sure
what the string is I should use to format the quadratic formula with
the 2 superscripted and the X's italicised. If someone could post a
pointer or two I would be most greatful.

Protected Overrides Sub OnPaint(ByVal vpe As PaintEventArgs)
MyBase.OnPaint(vpe)
Dim g As Graphics = vpe.Graphics
Dim BlackSolidBrush As SolidBrush = New SolidBrush(Color.Black)
Dim YCoord As Single = 100
Dim XCoord As Single = 100
Dim FormulaFont As New Font("Times New Roman", 12, _
FontStyle.Regular, GraphicsUnit.Pixel)
Dim QuadraticEquation As String = "0=aX2+bX+c"
g.DrawString(QuadraticEquation, FormulaFont, _
BlackSolidBrush, xCoord, yCoord)
End Sub


Thanking you all for reading this and your help in advance.
Chris
 
H

Herfried K. Wagner [MVP]

* (e-mail address removed) (Christian O'Connell) scripsit:
Hello - apologies if this has been asked before and already answered.
This is my first question and I have already unsuccessfully searched
Google groups and the on-line help files for the answer.

Here is what I am doing.

I am modifying a largish VB.Net program to make text appear, in the
quadratic equation, from

0=aX2+bx+c

to:

2
0=aX +bx+c

ie, the 2 is to be superscripted. And I also need to italise the X's.

Maybe you want to use a "ready-to-use" (but commercial) solution:

<http://www.soft4science.com/>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top