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的更多相关文章

  1. 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 ...

  2. System.Windows.Forms.Control : Component, IOleControl, IOleObject, IOleInPlaceObject, IOleInPlaceActiveObject....

    #region 程序集 System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ...

  3. ystem.Windows.Forms.SplitContainer : ContainerControl, ISupportInitialize

    #region 程序集 System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ...

  4. System.Windows.Forms

    File: winforms\Managed\System\WinForms\DataGridView.cs Project: ndp\fx\src\System.Windows.Forms.cspr ...

  5. WPF中实例化Com组件,调用组件的方法时报System.Windows.Forms.AxHost+InvalidActiveXStateException的异常

    WPF中实例化Com组件,调用组件的方法时报System.Windows.Forms.AxHost+InvalidActiveXStateException的异常 在wpf中封装Com组件时,调用组件 ...

  6. 体验Visual Studio 2015 Windows Forms应用程序开发与维护

    昨天到半夜还没有等到Visual Studio 2015的下载地址,实在熬不住就先休息了.北美地区的时区比北京时间要晚一些,今天早上到公司就看到Visual Studio 2015的下载地址,迅速的将 ...

  7. Double Buffering Windows Forms

    Double Buffering Windows Forms As much as we would like it not to be the case, graphics can be slow ...

  8. .net chart(图表)控件的使用-System.Windows.Forms.DataVisualization.dll

    这个案例指在介绍微软这套免费又功能强大的图表控件Microsoft Chart Controls for Microsoft .NET Framework 3.5,通过它,可让您的项目及报表,轻松套用 ...

  9. Windows Forms(二)

    导读 1.用VS创建一个Windows Forms程序 2.分析上面的程序 3.Mediator pattern(中介者模式) 4.卡UI怎么办——BackgroundWorker组件 用VS创建一个 ...

随机推荐

  1. z/os上的tar和gzip(2)

    前一篇文章写过了如何合成并压缩大批量文件,这篇文章解释一下如何在拿到压缩文件后如何解压并还原大批量文件.   解压缩的JCL很简单,如下所示,和压缩的JCL类似,只要把参数改成UNPACK,然后设置一 ...

  2. Nginx防蜘蛛爬虫处理

    假定一个场景:某个网站它可能不希望被网络爬虫抓取,例如测试环境不希望被抓取,以免对用户造成误导,那么需要在该网站中申明,本站不希望被抓取.有如下方法: 方法一:修改nginx.conf,禁止网络爬虫的 ...

  3. :eq(index)

    匹配一个给定索引值的元素 从 0 开始计数 查找第二行 HTML 代码: <table> <tr><td>Header 1</td></tr> ...

  4. 源码安装apache

    目标:源码安装apache 依赖包:apr.apr-util和pcre.其中pcre正则库要先安装,apr和apr-util(已解压)可以复制到apache下的资源库srclib下. 安装pcre: ...

  5. oracle 序列 ,check约束

    ====================序列 //查询当前用户序列 select * from user_sequences //查询所有序列 select * from all_sequences; ...

  6. C# 探索c#之Async、Await剖析

    探索c#之Async.Await剖析 作者:蘑菇先生 出处:http://mushroom.cnblogs.com/

  7. web.xml完整配置

    <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java ...

  8. Extended Data Type Properties [AX 2012]

    Extended Data Type Properties [AX 2012] This topic has not yet been rated - Rate this topic Updated: ...

  9. ios app的真机调试与发布配置

    1.打开应用程序—>[钥匙串访问]—>[证书助理]—>[从证书办法机构请求证书]     2.在[用户电子邮件地址]填入apple账户用的邮箱,选择[存储到磁盘],点击[继续],会在 ...

  10. 加载 pcntl 多进程

    加载 pcntl 有两种方式 一种重新编译安装,在编译时加 --enable-pcntl ./configure --prefix=/usr/local/php --with-mysql=/usr/l ...