Label - Static width & autoresized height?

Hi

Assume you have a Label component and a text:
stringstr ="Probae etsi in segetem sunt deteriorem datae fruges, tamen ipsae suaptae enitent";

If you set:
Label1.AutoResize =true;
you will only have one row (and the label may exceed the the right bound of the form).

I wonder if anyone has a smart solution of how to get a static width and a dynamic (autoresized) height?

One solution of mine is to take measurements of the string (this.CreateGraphics().MeasureString(str, font)), and then insert"\n" to the string in the correct places.

Does anyone have a more proper solution?

Kind Regards
[2590 byte] By [PublicError] at [2007-12-22]
# 1
Does this do what you want?

Label1.Text = "Probae etsi in segetem sunt deteriorem datae fruges, tamen ipsae suaptae enitent"
Label1.MaximumSize = New System.Drawing.Size(150, 1000)
Label1.AutoSize = True

JanHyde at 2007-8-30 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 2
Hi Jan

That worked perfectly!
Thanks!

PublicError at 2007-8-30 > top of Msdn Tech,Windows Forms,Windows Forms General...