David ChopperField David ChopperField - 1 year ago 137
C# Question

how to set flowlayout button to center of form

i got a few button on flowlayout button, and i want to set it precisely at middle of form.
on the image below i set the button precisely at middle by setting the flowlayout padding manually by 400 to left.


but when i try to resize or restore down the button wont at middle anymore because of manually set of padding. is there anything that i can do to set the button in middle by code ? whenever i try to resize it

iam following the answer base on
how to set image index and fill the image

Answer Source

Perform these settings on controls:

  • Add your images to a FolowLyoutPanel
    • Set AutoSize of FolowLyoutPanel to true
    • Set AutoSizeMode of FlowLayoutPanel to GrowAndShrink
    • Set Anchor proprty of FlowLayoutPanel to Top, Bottom
  • Use a TableLayoutPanel for hosting the FlowLayoutPanel
    • Use a single Column and a single Row in TableLayoutPanel.
    • Set Dock property of TableLayoutPanel to Bottom.

This way, when you add or remove images dynamically, all images will be shown at bottom center of the form.