Displaying superscript and subscript text in a label in .net(Windows Application)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • siri11
    New Member
    • Sep 2007
    • 38

    #1

    Displaying superscript and subscript text in a label in .net(Windows Application)

    hi everyone..

    Please can anyone tell me how to display the formulae using superscript (Ex:- Kg/m2 here 2 is superscript text) and subscript (NO2 - here 2 is subscript text) in Label control in .net (windows application)

    Thanks in advance
    siri
  • cloud255
    Recognized Expert Contributor
    • Jun 2008
    • 427

    #2
    Hi there,

    I dont know of any easy way to do this, i also searched around the net a bit and didn't find anything, i did make a class which makes super/sub script labels. The class is really not neat or pretty.

    I basically ask the class client for 2 strings, a value to indicate super/sub script and the location of the label.

    I then create 2 labels the main one and a second smaller label, the location of the smaller labe is dependant on the super/sub option.

    The output looks fine, you must however supply the location data in code, but i'm sure that if you define a constant point or set of points it would be neater to use.

    It is possible to do this, i have made a class, but its not very comfortable to use. Maybe you should check if a comercial control is not avaliable for doing this.

    If you do decide to create your own class and get stuck, post your problem here and i will have a look at it.

    P.S.
    Maybe someone else out there does know of a clean, neat way to do this...

    Comment

    Working...