跳到主要内容

CreateSolidFill

创建纯色填充,使用所选纯色作为对象背景应用于对象。

语法

expression.CreateSolidFill(color);

expression - 表示 Api 类的变量。

参数

名称必需/可选数据类型默认值描述
color必需ApiColor用于元素填充的颜色。

返回值

ApiFill

示例

此示例展示如何创建纯色填充。

// Creates a solid fill to apply to the shape using the selected solid color as the shape background.

// How to create the ApiFill object which represents a solid fill and apply it to the ApiShape class.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
let fill = Api.CreateSolidFill(Api.RGB(255, 111, 61));
let stroke = Api.CreateStroke(0, Api.CreateNoFill());
let shape = Api.CreateShape("roundRect", 5930900, 395605, fill, stroke);
paragraph.AddDrawing(shape);