跳到主要内容

GetIconYPos

获取按钮控件图标的 y 位置。

语法

expression.GetIconYPos();

expression - 表示 ApiButtonWidget 类的变量。

参数

此方法没有任何参数。

返回值

percentage

示例

此示例从带图像的字段获取图标 Y 坐标位置。

let doc = Api.GetDocument();
let page = doc.GetPage(0);
let buttonField = Api.CreateImageField([10, 10, 120, 100]);
page.AddObject(buttonField);

let widgets = buttonField.GetAllWidgets();
widgets[0].SetLayout('iconTextV');
widgets[0].SetImage('https://static.onlyoffice.com/assets/docs/samples/img/onlyoffice_logo.png', 'normal');
widgets[0].SetLabel('Icon Y position is: ' + widgets[0].GetIconXPos());