CreateStroke
创建为元素添加阴影的笔触。
语法
expression.CreateStroke(width, fill, sDash);
expression - 表示 Api 类的变量。
参数
| 名称 | 必需/可选 | 数据类型 | 默认值 | 描述 |
|---|---|---|---|---|
| width | 必需 | EMU | 以英制度量单位度量的阴影宽度。 | |
| fill | 必需 | ApiFill | 用于创建阴影的填充类型。 | |
| sDash | 可选 | DashType | "solid" | 线条虚线类型。 |
返回值
示例
此示例演示如何创建笔触。
// 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);