I have a label that shows the file name .. I had to set AutoSize
of the label to False
for designing.
So when the file name text got longer tha
I think the easiest way could be to check the render size and if it is greater than the actual label size, decrease the fontsize of the label.
private void label3_Paint(object sender, PaintEventArgs e) {
Size sz = TextRenderer.MeasureText(label1.Text, label1.Font, label1.Size, TextFormatFlags.WordBreak);
if (sz.Width > label1.Size.Width || sz.Height > label1.Size.Height)
{
DecreaseFontSize(label1);
}
}
public void DecreaseFontSize(Label lbl) {
lbl.Font = new System.Drawing.Font(lbl.Font.Name, lbl.Font.Size - 1, lbl.Font.Style);
}