Search code examples
c#winformsautosizeflowlayoutpanel

Is it possible to specify the position of a Windows Form controls relative to another AutoSize'd control?


I have a Windows Form window containing a FlowLayoutPanel, an OK Button, and a Cancel Button. The Form and FlowLayoutPanel both have AutoSize enabled, and the FlowLayoutPanel grows or shinks depending on the items placed in it.

I am trying to figure out how to position the OK and Cancel Buttons in the same row directly below the FlowLayoutPanel. I can't just specify positions for them since the FlowLayoutPanel above them grows and shrinks.

Any ideas on how to solve this?


Solution

  • Put your two buttons in another panel (anything will do).

    Then put these two panels in another FlowLayoutPanel which arranges them top to bottom.