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创建一个 ...
随机推荐
- 基于UP-CUP6410点灯实验完成
远程点灯实验 实验目的: 实现远程点灯,通过gprs 自带调试软件发送信息,完成智能家具远程点灯实验. 1.定制arm系统 使用uboot资料自带的!在内核中添加pl2303串口驱动,进行u口转串口的 ...
- Watir资源列表【转】
Watir简介 "Watir" (发音与 water相近) 全写是 "Web Application Testing in Ruby".Watir是一款用Rub ...
- Elasticsearch多索引
在Elasticsearch中,一般的查询都支持多索引.只有文档API或者别名API等不支持多索引操作,因此本篇就翻译一下多索引相关的内容. 首先,先插入几条数据: $ curl -XPOST lo ...
- UIActionSheet和UIAlert
UIActionSheet: 首先,在.h文件中添加Protocol,(Protocol相当于Java中的interface) @interface ActionSheetViewController ...
- android 学习随笔五(界面)
把数据库内容显示到界面 清单文件设置为线性布局(5大布局属于ViewGroup) 在清单文件中可以增加View显示 LinearLayout ll = (LinearLayout) findViewB ...
- 161111、NioSocket的用法(new IO)
今天先介绍NioSocket的基本用法,实际使用一般会采用多线程,后面会介绍多线程的处理方法. 从jdk1.4开始,java增加了新的io模式--nio(new IO),nio在底层采用了新的处理方式 ...
- kvm虚拟机virt-manager启动报错
安装kvm,用virt-manager启动时报错如下: Traceback (most recent call last): File "/usr/share/virt-manager/v ...
- java UUID
UUID是Universally Unique Identifier的缩写,它是在一定的范围内(从特定的名字空间到全球)唯一的机器生成的标识符.UUID具有以下涵义: 经由一定的算法机器生成 为了保证 ...
- load-on-startup
在servlet的配置当中,<load-on-startup>1</load-on-startup>,一般出现在启动线程的servlet当中 含义是: 标记容器是否在启动的时候 ...
- rtc关机闹钟3 IAlarmManager
vim framework/base/core/java/android/app/IAlarmManager.aidl import android.app.AlarmManager;import a ...