When I add a Textbox or Checkbox in FlowLayoutPanel at runtime, it occupies the full width of the window as if the control’s Anchor Property is set to Right. As a workaround, I have to set AutoSize = false; Is this by design or I am just missing something?
The same behaviour when using the designer and the last control (textbox, label) dropped to the the panel always goes on top of the previous controls.
Yep… I thought it was a glitch in the matrix since everything worked but it turns out it was a last minute change to support horizontal Anchoring when AutoSize=true. Everything works perfectly and there is no need t change AutoSize anymore. The double click issue is also fixed. Will be in today’s update.
Using the same sample I sent you, I am seeing the same behaviour when flowlayoutpanel and textboxes are added at runtime. I have still to set Autosize=False so the textbox won’t anchor right and use the full row.
Using the designer, if i click & drag a TextBox into the window/form without the flowlayoutpanel, the default width is zero (0) and can’t see the textbox if it loses focus. If it is into a flowlayoutpanel, it still occupies the full row of the panel as before. But it is now in proper order. Autosize should be set to False in Properties window to make it work.
Double-click a textbox has a different story. Of course, the first you do it, it goes on top. Double-click again and it goes on top of the first one. The third-time you double-click the textbox, it will already be in proper sequence. So, the order of textboxes inside the flowlayoutpanel would be textBox2, textBox3, textBox4,…. and textBox1 would be the last one. Also, set Autosize=False to make it work.
I am now using 1.2.82. Honestly, I have already tested this in 1.2.80 and it seems working properly already.
You are right. Setting the combobox will resolve the issue. If I may add, inserting a label control before the combobox thru code without changing Autosize property, the combobox will be in the right position. Don’t know how and why.
Just tried, I see the issue now:
When autosize is true, the control expands to fill the row. This is a bug in the layout engine, will log. Autosize should only force the height in this case.
In your sample set AutoSize false on the combobox as well and it will work.
When you drag a control on the flow layout panel you should see a small I marker to show he insertion point. It works when moving controls inside the flow layout panel but when dropping a new control it always ends up on top – bug as well.
That’s what I understand and I was just surprised. The code I sent you doesn’t dock any controls added to the FlowLayoutPanel except for the panel itself. How about adding the textbox using the designer?
Anyway, I’ll try to look at the screencast you are referring to.
Controls in the flow layout panel should not be docked or anchored (we should probably change the layout engine to ignore those settings). The flowlayout panel manages the children location and flow direction. You can set the flow break property to force a new line. We added a new property FillWeight to achieve a better responsive, controls with the FillWeight will fill the row proportionally. You can use Min/MaxSize to limit the automatic expansion.
There is also a screencast an small sample app in my last reply there. When you see the screencast, the last panel shows the fillweight in action.
Please login first to submit.