跳到主要内容

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 spreadsheet.

let worksheet = Api.GetActiveSheet();
let fill = Api.CreateSolidFill(Api.RGB(255, 200, 100));
let stroke = Api.CreateStroke(8 * 12700, Api.CreateSolidFill(Api.RGB(0, 0, 255)));
let line = worksheet.AddShape("line", 60 * 36000, 40 * 36000, fill, stroke, 3, 0, 2, 2);
let retrievedStroke = line.GetLine();
let result = retrievedStroke.SetCapType("square");
worksheet.GetRange("A1").SetValue("Cap type set: " + result);