tags:

views:

140

answers:

2

I have a text box with a certain width and a string. How do I know how many characters fit from the end of the string until the end of the line?

A: 

you can't, first because different characters take up different widths and second because text is rendered differently on different platforms.

Evernoob
+5  A: 

The number of characters that will fit depends on the font and what characters they are. If you know what characters you will use, or are using a fixed-width font, you can use Graphics.MeasureString().

Jon B