调整FlowLayoutPanel中用户控件之间的间距 [英] Adjusting spacing between usercontrols in a FlowLayoutPanel

查看:574
本文介绍了调整FlowLayoutPanel中用户控件之间的间距的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个WinForms应用程序窗口(窗体),在其中使用FlowLayoutPanel,并向其中添加了用户控件.现在,我一直在浏览FlowLayoutPanel和UserControl的属性,但似乎找不到与用户控件之间的间距有关的内容.我希望用户控件彼此之间更接近,即使只有几个像素也是如此.用户控件本身在numericUpDown的两侧都没有空间.任何建议都会有所帮助.

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.

我的FlowLayoutPanel:

My FlowLayoutPanel:

推荐答案

Panel和其他类似控件均具有MarginPadding属性.填充确定控件(例如面板)内部的间距.如果将Panel控件中的Padding设置为3(全部),则控件将在控件的内部边缘上捕捉到3个像素的填充.

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.

保证金的工作方式相同,但在其他控件之间.如果边距"设置为3(全部"),则控件将自动对齐到边距间距.

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

我没有使用过FlowLayoutPanel,但是一次,IIRC,您可以为单元格设置填充.检查您的用户控件上的边距,并检查布局单元格的填充.将一个设置为0,将另一个设置为3.

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.

这篇关于调整FlowLayoutPanel中用户控件之间的间距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆