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 Snaplines

Snaplines give you an accurate and intuitive way to align controls on your form.

They appear when you are moving a selected control or controls near a position that would align with another control or set of controls.

Your selection will "snap" to the suggested position as you move it past the other controls.

To arrange controls using snaplines

1.Drag a Button control from the Toolbox onto your form.
2.Move the Button control to the lower-right corner of the form. Note the snaplines that appear as the Button control approaches the bottom and right borders of the form. These snaplines display the recommended distance between the borders of the control and the form.
3.Move the Button control around the borders of the form and note where the snaplines appear. When you are finished, move the Button control near the center of the form.

snapline在你拖动到form边界的时候,会出现。

 

Aligning to Form and Container Margins

Snaplines help you to align your controls to form and container margins in a consistent manner.

 To align controls to form and container margins

 1.Select one of the Button controls and move it close to the right border of the form until a snapline appears.
The snapline's distance from the right border is the sum of the control's Margin property and the form's Padding property values.
snapline到右边界的距离,是控件margin属性以及formpadding属性的值的和。
 
Note:
If the form's Padding property is set to 0,0,0,0, the Windows Forms Designer gives the form a shadowed Padding value of 9,9,9,9. To override this behavior, assign a value other than 0,0,0,0.

 

1.Change the value of the Button control's Margin property by expanding the Margin entry in the Properties window and setting the Allproperty to 0.

For details, see Walkthrough: Laying Out Windows Forms Controls with Padding, Margins, and the AutoSize Property.

2.Move the Button control close to the right border of the form until a snapline appears. This distance is now given by the value of the form's Padding property.

 

3.Drag a GroupBox control from the Toolbox onto your form.

4.Change the value of the GroupBox control's Padding property by expanding the Padding entry in the Properties window and setting the Allproperty to 10.

5.Drag a Button control from the Toolbox into the GroupBox control.

6.Move the Button control close to the right border of the GroupBox control until a snapline appears. Move the Button control within theGroupBox control and note where the snaplines appear.

 

作者:Chuck Lu    GitHub    
posted @   ChuckLu  阅读(230)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2015-10-18 git源码中的Makefile
2015-10-18 git clone 出错SSL certificate problem, verify that the CA cert is OK.
2015-10-18 linux切换用户
2015-10-18 linux系统中删除文件夹
2015-10-18 linux根目录下的文件夹
2015-10-18 CentOS升级git
2015-10-18 CentOS5.5上安装git
点击右上角即可分享
微信分享提示