المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Find maximum font size where string fits in a box [modified]



C# Programming
02-01-2010, 09:30 AM
I need a function to return the maximum font size (for a given font)such that a given
string will fit in a predefined box (rectangle).

That is, I want to use DrawString(string, font, brush, rectangle) to draw the string
in a fixed size box. Note that Drawstring will wrap the string automatically to fit
the width. I don't want any of the string to extend beyond the bottom of the box.

BTW, this for a windows application using forms.

Thanks for any suggestions!
Tom

modified on Saturday, January 30, 2010 5:50 PM