跳到主要内容

SetBehavior

设置按钮控件行为。

语法

expression.SetBehavior(behavior);

expression - 表示 ApiButtonWidget 类的变量。

参数

名称必需/可选数据类型默认值描述
behavior必需ButtonBehavior单击按钮时的高亮行为。

返回值

boolean

示例

在 PDF 文档中设置按钮控件的行为类型。

// Apply behavior type such as 'outline' to a button widget.

// Display the set behavior 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].SetBehavior('outline');
widgets[0].SetLabel('Behabior is: ' + widgets[0].GetBehavior());