SetBackgroundColor
设置当前表单的背景颜色。
继承自 ApiFormBase.SetBackgroundColor。
语法
expression.SetBackgroundColor(color);
expression - 表示 ApiPictureForm 类的变量。
参数
| 名称 | 必需/可选 | 数据类型 | 默认值 | 描述 |
|---|---|---|---|---|
| color | 可选 | ApiColor | 背景颜色。 |
返回值
boolean
示例
在文档中为图片表单应用背景颜色。
// How do I change the background color of a picture form in a document?
// Give a picture form a colored background to make it stand out in a document.
let doc = Api.GetDocument();
let pictureForm = Api.CreatePictureForm({"key": "Personal information", "tip": "Upload your photo", "required": true, "placeholder": "Photo", "scaleFlag": "tooBig", "lockAspectRatio": true, "respectBorders": false, "shiftX": 50, "shiftY": 50});
let paragraph = doc.GetElement(0);
paragraph.AddElement(pictureForm);
pictureForm.SetBackgroundColor(Api.HexColor('#FF6F3D'));