Question

enter image description here

I have here 2 buttons, dock at the bottom... But I want them side by side, not over and under. How can I do that?
I dock them because WindowState = Maximize. If I manually position them, they won't fill the space from left to right. I tried to use anchor, but it doesn't achieve what I want.

I want them like this even in full screen. thanks enter image description here

Était-ce utile?

La solution

Wrap your Buttons into a TableLayoutPanel:

Create a TableLayoutPanel with two columns and one row. Set the size of each column to 50%. Set the Dock property to DockStyle.Bottom.

Add a Button to each column. Set the Dock property of each Button to DockStyle.Fill.

Add this TableLayoutPanel to your Form/Container instead of the two Buttons directly:

enter image description here

Autres conseils

I'm not sure if it's the best way but it seems to do the job.

  • Drag a SplitContainer on to your form then change its Dock property to Bottom.
  • Drag your buttons into each side of the SplitContainer then change their Dock properties to fill.
  • Customize the size of your SplitContainer.

Hope it helps.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top