首页/ 接口索引/ 对齐 / 分布 / 变换

shape.SetBoundingBox(X, Y, Width, Height)

一次性设定外框的位置和大小,等于"定位 + 缩放"合并成一步。批量套版最省代码。

签名

shape.SetBoundingBox(X, Y, Width, Height)

说明

一次性设定外框的位置和大小,等于"定位 + 缩放"合并成一步。批量套版最省代码。

Python 示例(可直接运行)

依赖 pywin32。示例假定 app / doc / page / layer 已就绪。 见「连接与初始化」
Python
shape = app.ActiveSelectionRange(1)

shape.SetBoundingBox(0, 0, 80 / 25.4, 50 / 25.4)    # 左下角 0,0,宽 80mm 高 50mm
print("现在尺寸:", shape.SizeWidth * 25.4, "x", shape.SizeHeight * 25.4, "mm")

关于本类:对齐 / 分布 / 变换

对齐参数是整数枚举(Python 里没有 cdrAlignLeft 这种常量):1 左 / 2 右 / 3 水平居中 / 4 上 / 8 下 / 12 垂直居中。可以相加组合,比如 1+4 = 左上角。

同类其他接口