IsLockAspectRatio
检查当前图片表单的宽高比是否已锁定。
语法
expression.IsLockAspectRatio();
expression - 表示 ApiPictureForm 类的变量。
参数
此方法没有任何参数。
返回值
boolean
示例
此示例检查当前图片表单的宽高比是否已锁定。
// How to find out whether a picture form is fixed or not.
// Find out whether a picture form's size is fixed.
let doc = Api.GetDocument();
let pictureForm = Api.CreatePictureForm({"key": "Personal information", "tip": "Upload your photo", "required": true, "placeholder": "Photo", "scaleFlag": "tooBig", "respectBorders": false, "shiftX": 50, "shiftY": 50});
let paragraph = doc.GetElement(0);
paragraph.AddElement(pictureForm);
pictureForm.SetImage("https://static.onlyoffice.com/assets/docs/samples/img/onlyoffice_logo.png", Api.MillimetersToEmus(70), Api.MillimetersToEmus(80));
pictureForm.SetLockAspectRatio(true);
let lock = pictureForm.IsLockAspectRatio();
paragraph = Api.CreateParagraph();
paragraph.AddText("The aspect ratio of the picture form in this document is locked: " + lock);
doc.Push(paragraph);