跳到主要内容

SetLayout

设置按钮控件布局类型

语法

expression.SetLayout(layout);

expression - 表示 ApiButtonWidget 类的变量。

参数

名称必需/可选数据类型默认值描述
layout必需ButtonLayout按钮布局。

返回值

boolean

示例

在 PDF 文档中设置按钮控件的布局类型。

// Apply layout type such as 'iconTextV' to a button widget.

// Display the set layout value using the widget label.

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].SetLabel('Layout is: ' + widgets[0].GetLayout());