Click here to Skip to main content
16,005,120 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to create 10 panels in c# with 5 pixels gap and should be aligned?
Posted

how to create 10 panels in c# with 5 pixels gap and should be aligned
One of the ways: Create 20 panels. Alternate panels of height 5 pixels. Add all the panels to a base placeholder. While creating panels, set the align property for each of them. You can add a line break too after each panel addition.

Try!
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 30-Apr-12 1:47am    
Good, a 5.
--SA
Sandeep Mewara 30-Apr-12 2:01am    
Thanks SA.
VJ Reddy 30-Apr-12 2:29am    
Good answer. 5!
Sandeep Mewara 30-Apr-12 3:08am    
Thanks VJ.
The solution 1 given by Sandeep Mewara is good.

As an alternative a TableLayoutPanel can be used and a panel with Dock property set to DockStyle.Fill is added to each cell of the TableLayoutPanel. Then Left and Top margins of Panel is set as 5. For the panels in last row, in addition to left and top margins the Bottom margin is also set to 5 and for panels in last column, in addition to left, top margins the Right margin is also set to 5. So, that for the panel in the last row and last column all margins are set 5.
The Row heights and Column widths can be set in the TableLayoutPanel as required.
 
Share this answer
 
v2
Comments
Sandeep Mewara 30-Apr-12 3:07am    
Good answer. 5!
VJ Reddy 30-Apr-12 3:15am    
Thank you, Sandeep.

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