Adjusting spacing between usercontrols in a 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
和其他类似的控件同时具有 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 中调整用户控件之间的间距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 FlowLayoutPanel 中调整用户控件之间的间距
基础教程推荐
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- 如何激活MC67中的红灯 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- 将 XML 转换为通用列表 2022-01-01