How to Implement AutoSize
Posted
by TheCloudlessSky
on Stack Overflow
See other posts from Stack Overflow
or by TheCloudlessSky
Published on 2010-05-20T15:25:44Z
Indexed on
2010/05/20
15:50 UTC
Read the original article
Hit count: 192
I'm trying to figure out a good way to auto-size a Rectangle
that has text drawn inside of it. I basically want the size to have a ratio of width/height and then "grow" according to that ratio to fit the text. I've looked at Graphics.MeasureString
but I don't think it does what I'm looking for (maybe it does and I'm just using it wrong).
I don't want to specify a specific width of the rectangle to be drawn, instead I want to say find the smallest width/height to fit this text but the found rectangle must have some specific ratio of width and height.
This doesn't have to be specific to C#, any idea for solving this problem I'm sure can be mapped to C#.
Thanks!
© Stack Overflow or respective owner