跳到主要内容

CreateSolidFill

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

语法

expression.CreateSolidFill(color);

expression - 表示 Api 类的变量。

参数

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

返回值

ApiFill

示例

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

// How to color a background.

// Add solid fill color as a shape background.

const presentation = Api.GetPresentation();
const slide = presentation.GetSlideByIndex(0);
slide.RemoveAllObjects();

const rgbColor = Api.RGB(255, 111, 61);
const fill = Api.CreateSolidFill(rgbColor);
const stroke = Api.CreateStroke(0, Api.CreateNoFill());
const drawing = Api.CreateShape("flowChartMagneticTape", 300 * 36000, 130 * 36000, fill, stroke);
drawing.SetPosition(608400, 1267200);
slide.AddObject(drawing);