How do i show superscripted string in Label or form name property.
I have found few questions like this one but was wondering if there is an way to do it for characters like 'a-z'?
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'
3.Select the charcter and paste into the property like label.Text
It will look something like
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With