views:

64

answers:

0

hi all

how could one write a version of Graphics::MeasureString(String, Font, Int32) that takes a maximum height instead of width?

the reason behind this question is that i have a label that i would like to resize to a specific height, and have the contained text automatically re-flow to take up as little horizontal space (there is a maximum width for the text as well) as possible and as much of the vertical space as possible - if that makes sense :) having some trouble figuring this out (when i specify a max height/width with TextRenderer.MeasureText it always seems to prefer horizontal extent over vertical extent). ive tried the various options now with not much luck - is this possible without some horrible iterative heuristical guessish code?

cheers fusi