Winforms label text not showing completely

Viewed 163

Here is the code I am using to add a label to a simple form:

Label myLabel = new Label();
myLabel.Text = "Hello how are you This is an example label in my first form";
myLabel.Location = new Point(50,20);

Here when the form is run, the label shows up, but partially, the all text does not show. How to make the full label text show up in the form?

Thanks in advance

1 Answers

I think you are missing the AutoSize property. By making that true, the label text will automatically size and completely show up. Add this:

myLabel.AutoSize = true;
Related