Jon N. Jon N. - 1 year ago 70
C# Question

Table Layout Panel and docked panel not adjusting

I have a C# winforms application that has table layout panel. The panel is set so that there are two columns, with a 75/25 % split. In the larger section is a docked panel that holds some controls, while the smaller section has a docked panel with a single label. We push a wall of text to the label on the right and it is getting jammed up ugly.

enter image description here

I've adjusted the controls on the large section and recovered some space that I want to give over to the label panel. The "Completed" and "Inspected" labels and dropdowns are not in use, and set to invisible currently. I used designer to adjust the split on the table layout panel to be 65/35 %, but the docked panel and the label didn't change position on the layout.

What I want to happen is for the table layout panel to have a larger portion of the split given over to the label and the label to fill the new space when text is set to it.

The results of my efforts haven't gone very far. I adjusted the split %, but the label looks unchanged. It seems to be the exact same size it was before making changes. It looks like the label maintained the same position as well, stuck to the right hand border of the panel. The label definately isn't extending past where it originally ended/started with the 75/25 split.

The sub panel and the label are set up to fill and anchor top/left. The panel is docked to the table layout panel. I was under the impression that the docking and filling would account for the change in the split, but I'm wrong about that I guess. I feel like this whole problem has some root in these settings, but my tinkering with them hasn't changed anything that I can tell.

enter image description here

Answer Source

Following the instructions provided by LarsTech, I adjusted the settings on the layout panel to be absolute pixel value on the left hand side and 100% on the right. I then set the panel anchor to top, right. I set the label itself to dock = fill. The label is now stretching across the entire area covered by the blue arrow.

Thanks again. Would give a +1 to your comment if I could.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download