Margin and Padding in Windows Forms Controls
https://msdn.microsoft.com/en-us/library/ms229627.aspx
Margin and Padding
Precise placement of controls on your form is a high priority for many applications.
The System.Windows.Forms namespace gives you many layout features to accomplish this.
Two of the most important are the Margin and Padding properties.
Margin
The Margin property defines the space around the control that keeps other controls a specified distance from the control's borders.
Padding
The Padding property defines the space in the interior of a control that keeps the control's content (for example, the value of its Text property) a specified distance from the control's borders.
图示
The following illustration shows the Padding and Margin properties on a control.

There is design-time support for this feature in Visual Studio. Also see Walkthrough: Laying Out Windows Forms Controls with Padding, Margins, and the AutoSize Property.
Margin and Dock
Margin是控件和父容器的距离;Padding是控件作为父容器的时候,和内部其他控件的距离。
实际使用的时候,默认的边界距离【snapline出现的时候】。是控件的margin和父容器的padding的距离之和。
https://msdn.microsoft.com/en-us/library/system.windows.forms.control.margin(v=vs.110).aspx
Setting the Margin property on a docked control has no effect on the distance of the control from the the edges of its container.
关于Margin属性,在控件使用Dock模式的时候,非DockStyle.None的时候,Margin属性不生效。【可以通过父容器的Padding来控制边界】
Margin属性不生效的方式和DockStyle类型有关,DockStyle.Top和Margin.Top对应,设置DockStyle.Top的时候Margin.Top失效。其他的还保持有效
Margin and Padding in Windows Forms Controls的更多相关文章
- Walkthrough: Arranging Controls on Windows Forms Using Snaplines
https://msdn.microsoft.com/en-us/library/t5b5kc41(v=vs.110).aspx Spacing and Aligning Controls Using ...
- System.Windows.Forms.Control : Component, IOleControl, IOleObject, IOleInPlaceObject, IOleInPlaceActiveObject....
#region 程序集 System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ...
- ystem.Windows.Forms.SplitContainer : ContainerControl, ISupportInitialize
#region 程序集 System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ...
- System.Windows.Forms
File: winforms\Managed\System\WinForms\DataGridView.cs Project: ndp\fx\src\System.Windows.Forms.cspr ...
- WPF中实例化Com组件,调用组件的方法时报System.Windows.Forms.AxHost+InvalidActiveXStateException的异常
WPF中实例化Com组件,调用组件的方法时报System.Windows.Forms.AxHost+InvalidActiveXStateException的异常 在wpf中封装Com组件时,调用组件 ...
- 体验Visual Studio 2015 Windows Forms应用程序开发与维护
昨天到半夜还没有等到Visual Studio 2015的下载地址,实在熬不住就先休息了.北美地区的时区比北京时间要晚一些,今天早上到公司就看到Visual Studio 2015的下载地址,迅速的将 ...
- Double Buffering Windows Forms
Double Buffering Windows Forms As much as we would like it not to be the case, graphics can be slow ...
- .net chart(图表)控件的使用-System.Windows.Forms.DataVisualization.dll
这个案例指在介绍微软这套免费又功能强大的图表控件Microsoft Chart Controls for Microsoft .NET Framework 3.5,通过它,可让您的项目及报表,轻松套用 ...
- Windows Forms(二)
导读 1.用VS创建一个Windows Forms程序 2.分析上面的程序 3.Mediator pattern(中介者模式) 4.卡UI怎么办——BackgroundWorker组件 用VS创建一个 ...
随机推荐
- C++中关于无法解析的外部符号问题LNK2019问题的总结
网上一般有很全面的解决方法,最近恰好本道长也遇到了这种问题,也恰好解决了,这种问题应该算作配置问题,而非程序本身问题,多数是因为接手了生疏的程序导致,此问题看上去很简单,但木有经验的话很 ...
- SQL内连接与外连接的区别【转】
--表stuid name 1, Jack2, Tom3, Kity4, nono--表examid grade1, 562, 7611, 89 内连接 (显示两表id匹配的)select stu.i ...
- Imageloarder
首先需要加载jar包,和在配置文件中配置Mainactivity.javapackage com.baidu.day13_2imageloader; import com.nostra13.unive ...
- C语言资源
0.C自带库/函数在线文档 http://www.acm.uiuc.edu/webmonkeys/book/c_guide/ 1.so文件制作和使用 http://blog.csdn.net/love ...
- JSP页面显示乱码
下面的显示页面(display.jsp)就出现乱码: <html> <head> <title>JSP的中文处理</title> <meta ht ...
- 为该目录以及子目录添加index.html
add index.html to a directory recursively using Perl5 使用的目录,是从Perl下载的perl5.18.2的文档 Look Here #!/usr/ ...
- linux用户栈内核栈的设置---进程的创建: fork/execve【转】
转自:http://blog.csdn.net/u011279649/article/details/18795547 版权声明:本文为博主原创文章,未经博主允许不得转载. 目录(?)[-] 应用层怎 ...
- win7无法通过DHCP获得IP地址
问题:win7无法通过DHCP获得IP地址(手动设置没有问题),但XP可以自动获取. 前些时候,某局域网反应部分WIN7系统无法正常从DHCP服务器(windows dhcp 服务器)获取ip地址,交 ...
- 22、JSON/jQuery上
1)掌握JSON及其应用 2)了解jQuery的背景和特点 3)理解js对象和jQuery对象的区别 4)掌握jQuery九类选择器及应用(上) 声明:今天服务端我们使用Struts2技术 一 ...
- 15、Jdbc的优化(BeanUtils组件)
Jdbc的优化! BeanUtils组件 自定义一个持久层的框架 DbUtils组件 案例优化 1. BeanUtils组件 1.1 简介 程序中对javabean的操作很频繁, 所以apach ...