Automatically scaling font size

10-11-2006, 01:58 PM

In GDI+, I'm trying to make some text fill as much of a space in a rectangle as possible... I've got part of my problem solved; I've got the text automatically wrapping when it reaches the edge of the rectangle.

What I'm trying to do now is automatically scale the font size so that it uses as much space within the rectangle as possible without overflowing.

I've been trying to figure this out for a few hours now, but I haven't had any luck with any of my experimentation or searches. Is this possible?

Thanks. :)

10-11-2006, 03:41 PM
You'll probably have to do some sort of loop to loop through font sizes and the Graphics object's .MeasureString function to find which font goes over the width of the rectangle.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum