Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adjusting spacing between usercontrols in a FlowLayoutPanel

I'm building a WinForms application Window (form), inside that I'm using a FlowLayoutPanel, with usercontrols added to this. Now I've been looking through the properties of both the FlowLayoutPanel and UserControl but can't seem to find anything to do with the spacing between usercontrols. I want the usercontrols to be closer to each other, if only by a couple of pixels. The usercontrols themselves have no space either side of the numericUpDown. Any suggestions would be helpful.

My FlowLayoutPanel:

example flow layout panel

like image 615
wonea Avatar asked Jul 04 '12 14:07

wonea


1 Answers

Panel and other similar controls have both Margin and Padding properties. Padding determines spacing internal to the control ...such as a panel. If Padding is set to 3 (All) in a Panel control, then controls will snap to 3 pixels of padding against internal edges of the control.

Margin works the same way, but between other controls. If Margin is set to 3 (All), controls will automatically snap to the margin spacing.

I haven't used the FlowLayoutPanel but once and, IIRC, you can set padding for the cells. Check your margin on your user control, and check the padding for the layout cells. Set one to 0 and the other to 3.

like image 70
IAbstract Avatar answered Oct 20 '22 11:10

IAbstract