Click here to Skip to main content
15,881,797 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a list box. some units will be populated inside it. there is radio button if i click on abbreviation the units like 'centimetercubed' should be diaplayed as cm^3...i.e,. 3 should be super scribed to cm....so pls help me....


Thanks in advance.

Regards,
Naveen
Posted

1 solution

There are two ways to do it, the easy way is to just use the proper unicode character. You can find the squared and cubed characters in the CharMap for the font (Win+R, type charmap then hit enter, find the character, copy and then paste in your Items collection). (Or, you can hold the ALT key down then type 0178 for the superscript 2, or ALT+0179 for the superscript 3, but this only works if you have a numeric keypad).

The other way to do it involves custom drawing each listbox item and is much more difficult. The listbox has a set of routines you can override or implement that allows custom drawing of the listbox items.

See this for an example:
http://msdn.microsoft.com/en-us/library/ms229679(v=vs.80).aspx[^]
 
Share this answer
 
v2

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900