[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework

How to pick up the size of font, that was a text fitted in an area?

Alexander Vasilevsky

6/11/2008 4:36:00 PM

There is a certain text and certain rectangle. It is needed to pick up the
size of font all the same by appearance, that a text fully blended in a
rectangle.

http://www... - Audio tools for C# and VB.Net developers


2 Answers

sa

6/12/2008 5:28:00 AM

0

try graphics.MeasureString method.

________________________
sa@dailycoding.com
http://www.daily...
DailyCoding.com - daily code for C#, .NET, ASP.NET, SQL

"Alexander Vasilevsky" <mail@alvas.net> wrote in message
news:g2outi$4qi$1@behemoth.volia.net...
> There is a certain text and certain rectangle. It is needed to pick up the
> size of font all the same by appearance, that a text fully blended in a
> rectangle.
>
> http://www... - Audio tools for C# and VB.Net developers
>
>


Pavel Minaev

6/12/2008 6:39:00 AM

0

On Jun 11, 8:36 pm, "Alexander Vasilevsky" <m...@alvas.net> wrote:
> There is a certain text and certain rectangle. It is needed to pick up the
> size of font all the same by appearance, that a text fully blended in a
> rectangle.
>
> http://www.... Audio tools for C# and VB.Net developers

I'm not aware of any straightforward way to do it. It seems that you'd
have to use Graphics.MeasureString or TextRenderer.MeasureText
(whichever one you prefer for text output), make a guess at the
initial size, and then do a binary search from there. I doubt it would
be particularly fast, though still probably worth a try.