MS .Net C# winform UI related tips:Increasing the width of label according to text width (winform Label wordwrap)

If you want Label to grow as its text grows:

Label.AutoSize=true;

(this will make your label to grow in width)
if you want text to get wrapped and your label to become, multiline automatically:

Label.MaximumSize = new Size(max_width_of_label, 0);
Label.AutoSize=true;

(in above label will grow but will not take care of other control, i mean it will not care about them, just try your self and see what happens)

You may also like to see:

Published in: on July 23, 2010 at 4:05 pm  Leave a Comment  
Tags: ,