The FlowLayoutEngine starts for the left on each new row. You can implement a custom layout by doing this:
public override bool Layout(object container, WinForms.LayoutEventArgs layoutEventArgs)
var panel = (FlowLayoutPanel)container;
// here you can go over all the controls in panel.Controls, detect the control in a single line and center it.
Thank you Luca, useful reply.
But please look at the attached image, do you think there is no way to center the last key without use margins?
I would need that the buttons they center themselves when the control is resized, and wrap
The flow layout panel always lays out the children according to the flow direction. You can set the FillWeight property of child controls to make the fill the remaining space when wrapping. Together with MinSize, MaxSize and FlowBreak it’s a powerful layout container.
You can also use the FlexLayoutPanel setting the layout to either Vertical or Horizontal and with that one you can set the AlignX property.
All these containers (FlowLayoutPanel, TableLayoutPanel, FlexLayoutPanel) are also extenders: they add properties to their children in the designer. Look for FillWeight, AlignX, AlignY, FlowBreak, RowSpan, ColumnSpan, Row, Column, Cell. They should be under the “Layout” category.
Please login first to submit.