Word wrap for a label in Windows Forms

In my case (label on a panel) I set label.AutoSize = false and label.Dock = Fill. And the label text is wrapped automatically.


The quick answer: switch off AutoSize.

The big problem here is that the label will not change its height automatically (only width). To get this right you will need to subclass the label and include vertical resize logic.

Basically what you need to do in OnPaint is:

  1. Measure the height of the text (Graphics.MeasureString).
  2. If the label height is not equal to the height of the text set the height and return.
  3. Draw the text.

You will also need to set the ResizeRedraw style flag in the constructor.


Actually, the accepted answer is unnecessarily complicated.

If you set the label to AutoSize, it will automatically grow with whatever text you put in it. (This includes vertical growth.)

If you want to make it word wrap at a particular width, you can set the MaximumSize property.

myLabel.MaximumSize = new Size(100, 0);
myLabel.AutoSize = true;

Tested and works.


There is no autowrap property but this can be done programmatically to size it dynamically. Here is one solution:

  • Select the properties of the label

  • AutoSize = True

  • MaximumSize = (Width, Height) where Width = max size you want the label to be and Height = how many pixels you want it to wrap

    Sample Properties