SetCapType
设置笔触的线端类型。
语法
expression.SetCapType(type);
expression - 表示 ApiStroke 类的变量。
参数
| 名称 | 必需/可选 | 数据类型 | 默认值 | 描述 |
|---|---|---|---|---|
| type | 必需 | LineCapType | 笔触的线端类型。 |
返回值
boolean
示例
在文档中为形状边框的端点设置方形线端。
// Change the cap type to control how the stroke ends are drawn.
// Create a line, retrieve its stroke, apply the square cap type, and display the result in a document.
let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
let fill = Api.CreateSolidFill(Api.RGB(255, 200, 100));
let stroke = Api.CreateStroke(8 * 12700, Api.CreateSolidFill(Api.RGB(0, 0, 255)));
let line = Api.CreateShape("line", 100 * 36000, 50 * 36000, fill, stroke);
paragraph.AddDrawing(line);
let retrievedStroke = line.GetLine();
let result = retrievedStroke.SetCapType("square");
paragraph.AddText("Cap type set: " + result);