跳到主要内容

GetFill

获取笔触的填充(颜色)。

语法

expression.GetFill();

expression - 表示 ApiStroke 类的变量。

参数

此方法没有任何参数。

返回值

ApiFill | null

示例

获取描边的填充颜色。

// Creates a shape with a colored border and retrieves its fill properties.
let presentation = Api.GetPresentation();
let slide = presentation.GetSlideByIndex(0);
let fill = Api.CreateSolidFill(Api.CreateRGBColor(255, 200, 100));
let stroke = Api.CreateStroke(2 * 36000, Api.CreateSolidFill(Api.CreateRGBColor(0, 0, 255)));
let shape = Api.CreateShape("rect", 100 * 36000, 50 * 36000, fill, stroke);
shape.SetPosition(2000000, 1000000);
slide.AddObject(shape);
let content = shape.GetDocContent();
let paragraph = content.GetElement(0);
let strokeObj = shape.GetLine();
if (strokeObj) {
let strokeFill = strokeObj.GetFill();
if (strokeFill) {
paragraph.AddText("Stroke fill type: " + strokeFill.GetType());
}
}