I have a button in VB.NET where I have a long Button Label.
(I'm using VS 2008 incase you need to know, don't worry its quite like VS 2003/VS 2005)
The problem that the Label of the button is taken from an external source which can have as many as 100 chars or more!
So I want to truncate it and show
"My very large button label name 1 2 3"
"My very lar..."
Now most people use a char count limit:
But I don't want to use a monospaced font but instead a font where 'i' or 'l' is much thinner than 'O' or 'W'
So lets say I have a 10 char limit, becuase of that my button will look like
But you see in actuality the ten W's are much wider than the ten 'i's.
One way would be to find the actual width of each character by looking up the font in question. How can I get the width of the characters of installed fonts? Any API in .NET 2.0 or .NET 3.5?
Or even any external library would do.
Maybe even some strange command-line EXE that returns the char as a bitmap - then I can read the width of that char as a bitmap and make a LUT once and for all..... then constantly use that LUT to tell me which char is how wide.
I know how wide my button is so I can just keep adding chars as long as they fill up the button!
This post has been edited by RobinJet: 04 February 2008 - 02:09 PM