Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to use a FlowLayoutPanel control, and it works pretty well for what I want, but I need to change how it lays out the child controls (buttons in my case).

Right now, there are spaces between each button on the panel, and I want it to lay them out right next to each other (no space between buttons, either left-right or top-bottom). Basically I have up to 90 of these buttons arranged in different orders of left-right and top-bottom that I want basically sitting like a grid.

I wasn't able to figure out how to do this using my Google searches.

Can someone show me how?

Thanks!
Posted

1 solution

To get the appearance of a rectangular grid, the buttons will all have to be the same size. Then eliminate the inter-button spacing by setting each button's Margin to zero. Something like this:
Button btn = new Button();
btn.Size = new Size(200, 30);
btn.Margin = Padding.Empty;


Alan.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900