Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# .NET
Hi guys!
 
I want to make my label subscript or superscript. I try using special character but it's very limited. For example if I want to do something like m4 (4 is superscripted) I can't find it in the special character list.
 
Do I have to add another class? If yes, may I know how to do it or provide me with the sample.
 
Thanks.
Posted 20-Feb-13 21:39pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I don't think you can do this in a straightforward label (and definitely can't be done in a normal textbox). However you could convert a richTextBox to get the same effect.
 
Have a look at this article[^] as it has some sample code.
 
Also see the solutions here[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

I think I found out the best solution:
 
1. Use a RichTextBox with properties set with: BorderStyle none, BackColor control, and ReadOnly true.
2. Click here to set the offset. This is how subscript or superscript is set.
3. Click here to set the font attributes.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 395
1 Prakriti Goyal 254
2 Yogesh Kumar Tyagi 224
3 Sergey Alexandrovich Kryukov 183
4 CPallini 160
0 OriginalGriff 6,652
1 Sergey Alexandrovich Kryukov 5,449
2 Maciej Los 3,474
3 Peter Leow 3,303
4 DamithSL 2,505


Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 25 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100