Label word wrapping

Sharpeye500 picture Sharpeye500 · Mar 1, 2012 · Viewed 187k times · Source

Is there a way to do a word wrap in a .NET label control?

I know there is an alternate way of using a TextBox, make property BorderStyle to none, property ReadOnly to true and set property WordWrap and property Multiline to true.

Is there something for a label?

Answer

fa wildchild picture fa wildchild · Apr 9, 2012

Change your maximum size,

label1.MaximumSize = new Size(100, 0);

And set your autosize to true.

label1.AutoSize = true;

That's it!