Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SuperScript Label or Form name

How do i show superscripted string in Label or form name property.

enter image description here

I have found few questions like this one but was wondering if there is an way to do it for characters like 'a-z'?

like image 222
Sangram Nandkhile Avatar asked Oct 30 '13 12:10

Sangram Nandkhile


2 Answers

There are certain characters which are already there in charmap.exe and if you are specifically looking for X then it's possible using charmap utility.

1.Windows + R >> Open charmap.exe

2.Scroll down and look for your specific character, in your case it's 'X'

enter image description here

3.Select the charcter and paste into the property like label.Text

It will look something like

enter image description here

like image 55
Sangram Nandkhile Avatar answered Oct 20 '22 00:10

Sangram Nandkhile


You should better rely on the control meant for text-decoration: RichTextBox. You can configure it such that it looks like a Label. Sample code (richTextBox1 on main form):

richTextBox1.BackColor = richTextBox1.Parent.BackColor; //Backcolor of the RTB's container
richTextBox1.BorderStyle = BorderStyle.None;
richTextBox1.Text = "Bloggerx";
richTextBox1.Font = new Font(richTextBox1.Font.FontFamily, 10);
richTextBox1.SelectionStart = 7;
richTextBox1.SelectionLength = 1;
richTextBox1.SelectionCharOffset = 5;
richTextBox1.SelectionLength = 0;

Another option you have is relying on two different labels, adequately coordinated to get the appearance you want.

UPDATE

There is still another option (although I personally wouldn't use it) which is playing around with the encoding and the font families (some of them support super-and sub-scripts). Another answer has proposed what, in my opinion, is a very bad way to account for this alternative (relying on an external program); there are better ways to implement that. But, in any case, I don't think that this is a systematic, reliable and easy to implement method (you have to find the corresponding format and make sure that it accounts for all the situations you want); but something mention-worthy though.

like image 35
varocarbas Avatar answered Oct 19 '22 22:10

varocarbas