The following code works with winforms
:
while (label1.Width < System.Windows.Forms.TextRenderer.MeasureText(label1.Text,
new Font(label1.Font.FontFamily, label1.Font.Size, label1.Font.Style)).Width)
{
label1.Font = new Font(label1.Font.FontFamily, label1.Font.Size - 0.5f, label1.Font.Style);
}
How can I do this in WPF? The idea is to make a autoresize
in textbox
to fit all words.
The following image, which was cut in the last line, I want to decrease the font size until all the words are shown.
The above photo is not a label
, it is a textbox
.
Any ideas on what to do in WPF?