跳到主要内容

GetAllDrawings

获取页面上的所有绘图对象。

语法

expression.GetAllDrawings();

expression - 表示 ApiPage 类的变量。

参数

此方法没有任何参数。

返回值

Drawing[]

示例

如何获取页面上的绘图。

// Get drawing on a page and select it.

const doc = Api.GetDocument();
const page = doc.GetPage(0);

const fill = Api.CreateSolidFill(Api.CreateRGBColor(255, 111, 61));
const stroke = Api.CreateStroke(0, Api.CreateNoFill());
const shape = Api.CreateShape("flowChartMagneticTape", 425, 184, fill, stroke);
shape.SetPosition(48, 100);

const height = shape.GetHeight();
const docContent = shape.GetContent();
const paragraph = docContent.GetElement(0);
paragraph.AddText("Example drawing");
page.AddObject(shape);

const allDrawings = page.GetAllDrawings();
if (allDrawings.length > 0) {
const drawing = allDrawings[0];
drawing.Select();
}