跳到主要内容

CreateStroke

创建为元素添加阴影的笔触。

语法

expression.CreateStroke(width, fill, sDash);

expression - 表示 Api 类的变量。

参数

名称必需/可选数据类型默认值描述
width必需EMU以英制度量单位度量的阴影宽度。
fill必需ApiFill用于创建阴影的填充类型。
sDash可选DashType"solid"线条虚线类型。

返回值

ApiStroke

示例

此示例演示如何创建笔触。

// How to add a stroke to the shape.

// Add solid fill and stroke to the shape properties.

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

const gs1 = Api.CreateGradientStop(Api.RGB(255, 213, 191), 0);
const gs2 = Api.CreateGradientStop(Api.RGB(255, 111, 61), 100000);
const fill = Api.CreateLinearGradientFill([gs1, gs2], 5400000);
const fill1 = Api.CreateSolidFill(Api.RGB(51, 51, 51));
const stroke = Api.CreateStroke(3 * 36000, fill1);
const shape = Api.CreateShape("flowChartMagneticTape", 300 * 36000, 130 * 36000, fill, stroke);
shape.SetPosition(608400, 1267200);
slide.AddObject(shape);