tom tom - 5 months ago 32
C# Question

issue with flow layout panel / link labels

i am setting text to a link label and adding these labels to a flow layout panel. It seems to be chopping off the ends of the link labels and as such i have labels with only 3/4's of the text. Does anyone know why this might be?



I'm not sure if you are adding the LinkLabels to the FlowLayoutPanel through code, but there is a property you can set to make them work properly.

    var link = new LinkLabel();
    link.Text = "Some really long string";
    link.AutoSize = true;   //This is really important!


If you don't set each LinkLabels AutoSize property, they just chop off any text that goes further than their default bounds.

Edit: My Testapp consists of placing a FlowLayoutPanel on the form, and a button to click, with the above code in the OnClick handler. Nothing else was changed on the form.

Without the AutoSize property set to true, I had the same problem you described. Setting it to True fixes it for me at least :)