在 FlowLayoutPanel 中调整用户控件之间的间距

编程入门 行业动态 更新时间:2024-10-24 11:13:11
本文介绍了在 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 和其他类似的控件同时具有 Margin 和 Padding 属性.填充确定控件内部的间距......例如面板.如果在 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.

Margin 的工作方式相同,但在其他控件之间.如果 Margin 设置为 3(All),控件将自动捕捉到边距间距.

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 中调整用户控件之间的间距

本文发布于:2023-11-12 01:05:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1580069.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:间距   控件   用户   FlowLayoutPanel

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!