IShapeCollection
概述
IShapeCollection 是 Aspose.Slides FOSS 中用于 .NET 的接口。继承自:IEnumerable<IShape>。
表示属于幻灯片或组合形状的有序、可变的 IShape 对象集合。
此接口提供 20 个用于在 .NET 程序中处理 IShapeCollection 对象的方法。可用的方法包括:AddAutoShape、AddConnector、AddPictureFrame、AddTable、Clear、IndexOf、InsertAutoShape、InsertConnector、InsertPictureFrame、InsertTable、Remove、RemoveAt,以及另外 2 个方法。所有公共成员在安装了 Aspose.Slides FOSS for .NET 软件包后,对任何 .NET 应用程序均可访问。属性:AsICollection、AsIEnumerable、Count、ParentGroup。
属性
| 名称 | 类型 | 访问 | 描述 |
|---|---|---|---|
ParentGroup | IGroupShape? | 读取 | 获取拥有此集合的父组形状。 |
AsICollection | IList<IShape> | 读取 | 将集合暴露为通用列表接口。 |
AsIEnumerable | IEnumerable<IShape> | 读取 | 将集合暴露为可枚举接口。 |
Count | int | 读取 | 获取集合中形状的数量。 |
方法
| 签名 | 描述 |
|---|---|
ToArray() | 返回集合中的所有形状,作为一个新数组。 |
ToArray(startIndex: int, count: int) | 返回从指定索引开始的形状子集。 |
Reorder(index: int, shape: IShape) | 将单个形状移动到集合中指定的位置,改变其 z-order。 |
Reorder(index: int, shapes: IShape[]) | 将多个形状移动,使它们从指定位置开始,并保留相对顺序。 |
AddAutoShape(shapeType: ShapeType, x: float, y: float, width: float, height: float) | 创建一个新的自动形状并将其追加到集合中。 |
AddAutoShape(shapeType: ShapeType, x: float, y: float, width: float, height: float, createFromTemplate: bool) | 创建一个新的自动形状并将其追加到集合中。 |
InsertAutoShape(index: int, shapeType: ShapeType, x: float, y: float, width: float, height: float) | 创建一个新的自动形状并将其插入到指定位置。 |
InsertAutoShape(index: int, shapeType: ShapeType, x: float, y: float, width: float, height: float, createFromTemplate: bool) | 创建一个新的自动形状并将其插入到指定位置。 |
AddConnector(shapeType: ShapeType, x: float, y: float, width: float, height: float) | 创建一个连接器形状并将其追加到集合中。 |
AddConnector(shapeType: ShapeType, x: float, y: float, width: float, height: float, createFromTemplate: bool) | 创建一个连接器形状并将其追加到集合中。 |
InsertConnector(index: int, shapeType: ShapeType, x: float, y: float, width: float, height: float) | 创建一个连接器形状并将其插入到指定位置。 |
InsertConnector(index: int, shapeType: ShapeType, x: float, y: float, width: float, height: float, createFromTemplate: bool) | 创建一个连接器形状并将其插入到指定位置。 |
AddPictureFrame(shapeType: ShapeType, x: float, y: float, width: float, height: float, image: IPPImage) | 创建一个图片框并将其追加到集合中。 |
InsertPictureFrame(index: int, shapeType: ShapeType, x: float, y: float, width: float, height: float, image: IPPImage) | 创建一个图片框并将其插入到指定位置。 |
AddTable(x: float, y: float, columnWidths: double[], rowHeights: double[]) | 创建一个表格并将其追加到集合中。 |
InsertTable(index: int, x: float, y: float, columnWidths: double[], rowHeights: double[]) | 创建一个表并将其插入到指定位置。 |
IndexOf(shape: IShape) | 返回指定形状的零基索引,如果未找到则返回 -1。 |
RemoveAt(index: int) | 删除指定零基索引处的形状。 |
Remove(shape: IShape) | 从集合中删除指定形状的第一次出现。 |
Clear() | 从集合中移除所有形状。 |