跳到主要内容

GetDashType

获取笔触的虚线类型。

语法

expression.GetDashType();

expression - 表示 ApiStroke 类的变量。

参数

此方法没有任何参数。

返回值

DashType | null

示例

读取文档中形状边框的虚线图案。

// How do I find out what dash pattern is applied to a shape's border in a document?

// Retrieve and display the line dash style used on a shape border in a document.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
let fill = Api.CreateSolidFill(Api.CreateRGBColor(255, 200, 100));
let stroke = Api.CreateStroke(36000, Api.CreateSolidFill(Api.CreateRGBColor(0, 0, 255)));
let shape = Api.CreateShape("rect", 100 * 36000, 50 * 36000, fill, stroke);
paragraph.AddDrawing(shape);
paragraph.AddLineBreak();
let retrievedStroke = shape.GetLine();
let dashType = retrievedStroke.GetDashType();
paragraph.AddText("Dash type: " + (dashType ? dashType : "not set"));