lundi 30 mars 2015

How to get the amount of string fitted in a rectangle layout by text renderer

I am trying to draw a string on a bitmap, but if the text is too long, part of text may be clipped by the text renderer. If I can find which part of text was written I can write the rest of it on another bitmap.


Is there any text rendering function in C# so it gives a text and a proposed layout rectangle to draw text in the rectangle bounds and return the amount of string fitted in the layout rectangle?



string fittedString = TextRenderer.DrawText(graphics, text, rectangle);


If no, what is the easiest way to accomplish it?


Aucun commentaire:

Enregistrer un commentaire