首页/ 接口索引/ Shape 几何与变换

shape.SizeWidth / .SizeHeight

宽度 / 高度,读写。缩放时先读原尺寸再按比例算新尺寸。

签名

shape.SizeWidth / .SizeHeight

说明

宽度 / 高度,读写。缩放时先读原尺寸再按比例算新尺寸。

Python 示例(可直接运行)

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

w, h = shape.SizeWidth, shape.SizeHeight    # 读原尺寸
print("原尺寸:", w, "x", h)

shape.SizeWidth  = 100 / 25.4               # 只改宽度(会拉伸,不保持比例)
shape.SizeHeight = 60 / 25.4

print("新尺寸:", shape.SizeWidth, "x", shape.SizeHeight)

关于本类:Shape 几何与变换

位置、尺寸、旋转、包围盒。全部跟随 doc.Unit(你的环境是英寸),字号例外。

同类其他接口