获取或设置一个值,该值指示在调整形状大小时是否保持其原始比例;即形状的纵横比是否已锁定。 读取/写入 MsoTriState
语法
表达式。LockAspectRatio
expression 一个代表 Shape 对象的变量。
备注
如果调整形状大小时保持其原始比例,则 LockAspectRatio 值为 msoTrue 。 如果可以单独更改形状的高度和宽度,则此值为 msoFalse。
示例
以下示例创建了两个相同大小的三角形。 左三角形的纵横比已解锁,右三角形的纵横比已锁定。 图 1 显示了按相同量调整每个三角形大小时的结果。
Sub ResizeTriangles()
Dim shapeReport As Report
Dim reportName As String
Dim triangle1 As shape
Dim triangle2 As shape
reportName = "Triangle resize report"
Set shapeReport = ActiveProject.Reports.Add(reportName)
With shapeReport.Shapes
Set triangle1 = .AddShape(msoShapeIsoscelesTriangle, 10, 10, 100, 100)
Set triangle2 = .AddShape(msoShapeIsoscelesTriangle, 150, 10, 100, 100)
End With
triangle1.Select
triangle1.LockAspectRatio = msoFalse
triangle1.height = 200
triangle2.Select
triangle2.LockAspectRatio = msoTrue
triangle2.height = 200
End Sub
在图 1 中,选择了纵横比锁定的右侧形状。
图 1. 解锁或锁定纵横比时调整形状大小
属性值
MSOTRISTATE
另请参阅
形状对象ShapeRange.LockAspectRatio 属性MsoTriState
支持和反馈
有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。