wpf - resize text to largest possible size to fit a drawing rect with wraping -


These are many similar questions, but there is no good answer? I use a reference image to draw input text on a specific rect size "720,576", now I need to fit the entire text in the maximum font size while retaining the lines?

I tried to make it a calculation to calculate but no use. Until I covered the text, I also tried to loop size, but I could not test that situation, and I did not find any way to search for a week but to no avail!

Finally, I tried to use a visual box which I want but it does not allow the text to go in the form of multilingual since it is always all the text in the same line in the width Are there.

Here's what I found:

  & lt; Window x: orbit = "main window" xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns: x = "http://schemas.microsoft.com/winfx/2006/Xaml "Title =" main window "height =" 720 "width =" 576 "& gt; & Lt; Viewbox & gt; & Lt; TextBlock TextWrapping = "Wrap" horizontal alignment = "center" vertical alignment = "center text =" how are you doing how are you doing how are you doing how are you how you are doing How are you doing how are you doing how are you doing "" /> & Lt; / Viewbox & gt;   

Any help would be appreciated, thanks.

I can not reproduce the behavior you specify, for example, you can create a new project Can copy / paste It writes text on multiple lines; Maybe you have a default setter on an object, maybe the text box ...

Ok very easy: set the width to your text box so that your text will wrap the box. You might want width of the view box (pre-binding) width.

Comments