Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

Graphics.MeasureString - how to handle advanced settings, how to get breaks

$
0
0

Hi all;

I've been usingGraphics.MeasureString to measure line lengths. However, I now need to take into account:

  1. Small Caps
  2. Scaling (making each character thinner/wider).
  3. Spacing (adding/subtracting space after each character).
  4. Hyphenation, where line breaks can occur at specific places within words.

Is there a way to do this using MeasureString? The two fundamental things I need to get is:

  1. How long is a passed in string.
  2. For a passed in string and length, how many characters of the string fits in that length.

I can do this calling it character by character. But is there a better way?

Also, is there a better means of finding the break point in a string for a given length other than calling MeasureString and keep adding a letter to the string until I pass the length limit?

thanks - dave


Who will win The Windward International Collegiate Programming Championships?


Viewing all articles
Browse latest Browse all 8156

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>