title | ms.service | ms.assetid | ms.date | ms.localizationpriority |
---|---|---|---|---|
Shape.LockAspectRatio property (Project) |
project-server |
b465aad3-d253-d6ce-0f6e-bb0638733647 |
06/08/2017 |
medium |
Gets or sets a value that indicates whether the shape retains its original proportions when you resize it; that is, whether the aspect ratio of the shape is locked. Read/write MsoTriState
expression.LockAspectRatio
expression A variable that represents a Shape object.
The LockAspectRatio value is msoTrue if the shape retains its original proportions when it is resized. If you can change the height and width of the shape independently, the value is msoFalse.
The following example creates two triangles of the same size. The left triangle has the aspect ratio unlocked, and the right triangle has the aspect ratio locked. Figure 1 shows the result when each triangle is resized by the same amount.
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
In Figure 1, the right shape with the locked aspect ratio is selected.
Figure 1. Resizing a shape when the aspect ratio is unlocked or locked
MSOTRISTATE
Shape Object ShapeRange.LockAspectRatio Property MsoTriState
[!includeSupport and feedback]