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

Adjusting spacing between usercontrols in a FlowLayoutPanel(在 FlowLayoutPanel 中调整用户控件之间的间距)
本文介绍了在 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.

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 中调整用户控件之间的间距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)