I am trying to make a Label
in C#, which would wrap text the way it would have a fixed width, and variable height. I am using this code:
Label newMsg = new Label();
newMsg.AutoSize = true;
newMsg.MaximumSize = new Size(350, 400); //setting fixed width, max height to avoid being too high for container
newMsg.MinimumSize = new Size(350, 0); //fixed width, height doesn't matter
newMsg.Text = msg;
newMsg.Location = new Point(4, 7);
newMsg.BackColor = Color.Red; //red to see the actual size in contrast to its container
but it doesn't work. I tried to do some research why, and regardless if the text is one word or a whole paragraph, the newMsg.Height
is always 23.
Does anyone know why? Thanks