Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Subtext for C# label

Tags:

c#

I need to put some subtext in a Winforms C# labels .Text property. Is there any easy way to do this without writng my own control?

This would be the example in HTML

<sub>1a</sub>

Thanks, Paul.

like image 342
paulio Avatar asked Mar 13 '26 12:03

paulio


1 Answers

Here's a link to an already-written control that does exactly this:

http://www.freshnova.com/C-Tutorials/superscript-subscript-label.html

Update: you can also just use a RichTextBox (with BorderStyle none, BackColor control, and ReadOnly true). The RichTextBox's SelectionCharOffset lets you specify the height of text above or below the baseline in pixels, and then set its SelectedText property after each setting of SelectionCharOffset to mix-and-match text of different positions in the one box.

like image 79
MusiGenesis Avatar answered Mar 15 '26 01:03

MusiGenesis



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!