现在的位置: 首页 > 综合 > 正文

bound与clientarea区别

2013年08月09日 ⁄ 综合 ⁄ 共 548字 ⁄ 字号 评论关闭

bounds指边界范围。

clientarea指窗口的显示区域(即放置 子控件的有效区域),一般而言clientarea小于bounds。只有Composite等一些容器类才有ClientArea的说法。一般控件没有。

获取某控件的bounds:getBounds
由于布局有spacing,margin等:所以,很多时候x,y坐标可能不是0,clientarea也相较bounds的width,height小几个像素。

如,某个容器(comp使用的是RowLayout布局。)的ClientArea为
comp ClientArea: Rectangle {0, 0, 54, 28}

但里面放置的button的bounds为(只放置了button一个控件):
button: Rectangle {3, 3, 48, 22}

是因为RowLayout布局默认有上下,左右的margin。
comp marginTop: 3
comp marginHeight: 0
comp marginBottom: 3
comp marginLeft: 3
comp marginWidth: 0
comp marginRight: 3

上下相加,左右相加正好为6像素。button的width,height加上6个像素刚好为comp的clientArea
的width和height

【上篇】
【下篇】

抱歉!评论已关闭.