.netwinforms

How can I get a StackPanel-like layout in WinForms


I created a dialog with three buttons. I put those buttons in a FlowLayoutPanel with FlowDirection set to TopDown.

I attempted to Size the buttons to the width of the panel and then set the Anchor to Left+Top+Right. This seems to have no effect in a FlowLayoutPanel.

Is there a simple solution to this? I know I can use the FlowLayoutPanel's OnResize event, and go that direction, but was hoping for a design-time setting.


Solution

  • You can use the TableLayoutPanel, if the explicit row management isn't too annoying.