Align值 None, Top, Left, Right, Bottom, MostTop, MostBottom, MostLeft, MostRight, Client, Contents, Center, VertCenter, HorzCenter, Horizontal, Vertical, Scale, Fit, FitLeft, FitRight
2016-03-10 15:17:58| 分类: android-delphi | 标签:控件 align 属性 talignlayout |举报|字号 订阅
控件 Align 属性 TAlignLayout 类型 图解Edit1.Align :=TAlignLayout.Client;
center 位置始终在父容器 中间 大小可变化,但不随父容器变化,可以覆盖其他容器。途中黑色控件 设置成 bottom ,top,left,right 将不能被覆盖,绿色控件会在剩余部分的中间位置。
conterts 不会考虑其他控件的占用空间,充满整个父容器,当然,黑色控件在他上边,好像没有充满,但尺寸是按整个父容器计算的。
fit 总是想占满整个父控件,但受长宽比限制,也就是说谁父容器变化,但比例不变,有时会留下空白。fitleft 则是,左侧始终填满,其他方向维持比例。fitright 和它相反。
Horizontal 这个属性就保证水平方向是填满的,上下尺寸可调。和Vertical 正好相反。
scale 比较特殊,尽量维持原来的比例关系,控件本身会随着父控件比例变化大小,不受其他控件影响。
![Align值 None, Top, Left, Right, Bottom, MostTop, MostBottom, MostLeft, MostRight, Client, Contents, Center, VertCenter, HorzCenter, Horizontal, Vertical, Scale, Fit, FitLeft, FitRight - 李智勇 - 李智勇的博客](http://img2.ph.126.net/MJjN22MkObOumAgb0TwekA==/6598076919368047007.png)
none 类型,尺寸位置 可调,但不睡着窗体尺寸变化。
![Align值 None, Top, Left, Right, Bottom, MostTop, MostBottom, MostLeft, MostRight, Client, Contents, Center, VertCenter, HorzCenter, Horizontal, Vertical, Scale, Fit, FitLeft, FitRight - 李智勇 - 李智勇的博客](http://img1.ph.126.net/fYnEQ3bJ0lBT_NywfTeUZw==/6631340444588323279.png)
bottom 占据最下边位置,如果上边控件也设置成bottom 会挨着他排列,高度不变,宽度随父控件变化、
![Align值 None, Top, Left, Right, Bottom, MostTop, MostBottom, MostLeft, MostRight, Client, Contents, Center, VertCenter, HorzCenter, Horizontal, Vertical, Scale, Fit, FitLeft, FitRight - 李智勇 - 李智勇的博客](http://img2.ph.126.net/SSRABRK5POWDJXun_TRkWQ==/6631264578286009967.png)
![Align值 None, Top, Left, Right, Bottom, MostTop, MostBottom, MostLeft, MostRight, Client, Contents, Center, VertCenter, HorzCenter, Horizontal, Vertical, Scale, Fit, FitLeft, FitRight - 李智勇 - 李智勇的博客](http://img0.ph.126.net/kfdZUuTZGpjfoewZDEXyRA==/6631319553867399591.png)
![Align值 None, Top, Left, Right, Bottom, MostTop, MostBottom, MostLeft, MostRight, Client, Contents, Center, VertCenter, HorzCenter, Horizontal, Vertical, Scale, Fit, FitLeft, FitRight - 李智勇 - 李智勇的博客](http://img0.ph.126.net/24LqutmbLTqQoiplNPeq1g==/6631248085611591555.png)
client 绿色控件会填满 剩余部分空间,随父容器缩放。
![Align值 None, Top, Left, Right, Bottom, MostTop, MostBottom, MostLeft, MostRight, Client, Contents, Center, VertCenter, HorzCenter, Horizontal, Vertical, Scale, Fit, FitLeft, FitRight - 李智勇 - 李智勇的博客](http://img2.ph.126.net/uXbqxbcbtQZv6Bo42jVSPA==/6598299020716855304.png)
![Align值 None, Top, Left, Right, Bottom, MostTop, MostBottom, MostLeft, MostRight, Client, Contents, Center, VertCenter, HorzCenter, Horizontal, Vertical, Scale, Fit, FitLeft, FitRight - 李智勇 - 李智勇的博客](http://img1.ph.126.net/U9YhuwNWaTXCo-NHezem9Q==/3760505688954686158.png)
![Align值 None, Top, Left, Right, Bottom, MostTop, MostBottom, MostLeft, MostRight, Client, Contents, Center, VertCenter, HorzCenter, Horizontal, Vertical, Scale, Fit, FitLeft, FitRight - 李智勇 - 李智勇的博客](http://img1.ph.126.net/tEJmQ2LEqecqq3hg_I4biQ==/6631435002588316081.png)
![Align值 None, Top, Left, Right, Bottom, MostTop, MostBottom, MostLeft, MostRight, Client, Contents, Center, VertCenter, HorzCenter, Horizontal, Vertical, Scale, Fit, FitLeft, FitRight - 李智勇 - 李智勇的博客](http://img0.ph.126.net/KIyBSdBZCmk8A6N9pKs_Ww==/4917367843235482128.png)
HorzCenter保证水平方向居中
尺寸可以调
,但上下是填满的,尺寸随着父容器变化,代码不能改变。和VertCenter相反。
![Align值 None, Top, Left, Right, Bottom, MostTop, MostBottom, MostLeft, MostRight, Client, Contents, Center, VertCenter, HorzCenter, Horizontal, Vertical, Scale, Fit, FitLeft, FitRight - 李智勇 - 李智勇的博客](http://img0.ph.126.net/OXF9KvIbEGqxXkXrI-1dTw==/1627206840464720745.png)
![Align值 None, Top, Left, Right, Bottom, MostTop, MostBottom, MostLeft, MostRight, Client, Contents, Center, VertCenter, HorzCenter, Horizontal, Vertical, Scale, Fit, FitLeft, FitRight - 李智勇 - 李智勇的博客](http://img2.ph.126.net/rUzDAS9PgLiwUcyKlb48ug==/6598082416926184544.png)
![Align值 None, Top, Left, Right, Bottom, MostTop, MostBottom, MostLeft, MostRight, Client, Contents, Center, VertCenter, HorzCenter, Horizontal, Vertical, Scale, Fit, FitLeft, FitRight - 李智勇 - 李智勇的博客](http://img1.ph.126.net/2XJ2PjdufqRDRYIRvDtheA==/6631348141169720719.png)
![Align值 None, Top, Left, Right, Bottom, MostTop, MostBottom, MostLeft, MostRight, Client, Contents, Center, VertCenter, HorzCenter, Horizontal, Vertical, Scale, Fit, FitLeft, FitRight - 李智勇 - 李智勇的博客](http://img2.ph.126.net/U4AxEqmZVD45QTyt28ENdA==/6631451495262748211.png)
left,剩余空间的左部分填满,强调剩余部分,top ,bottom ,right ,同理。
![Align值 None, Top, Left, Right, Bottom, MostTop, MostBottom, MostLeft, MostRight, Client, Contents, Center, VertCenter, HorzCenter, Horizontal, Vertical, Scale, Fit, FitLeft, FitRight - 李智勇 - 李智勇的博客](http://img1.ph.126.net/ftzLayKeYCnElmHeXnUUQQ==/6631208503192996390.png)
mostleft 只是比left 多占,父控件的左部分空间,不考虑其他控件占的空间。