How to break the line of a label automatically?

1
  .NET Framework 4.0 Visual C # = =

I have a problem with labels , when I assign a value to the property text and this value is too large, it "breaks" its container, surpassing the borders, with that, the part that is out of bounds it is not possible to be seen. What I'm looking for is a solution to this, break the text automatically (from space, do not break the word) when it reaches 5 pixels from the right edge, however, I have no idea how to do it.

I've already thought about turning off the AutoSize property, but it's not feasible, because the height of the text is also limited.

    
asked by anonymous 17.05.2014 / 00:28

1 answer

6

You may be doing something like this:

label1.MaximumSize = new Size(100, 0);
label1.AutoSize = true;
label1.Text = "Stack Overflow em Portugues";

The result will be:

Fonte

    
17.05.2014 / 00:31