AddConnector
内容
[
隐藏
]AddConnector(ShapeType, float, float, float, float)
创建一个新的连接器,从默认模板调整并将其添加到集合的末尾。
public IConnector AddConnector(ShapeType shapeType, float x, float y, float width, float height)
参数 | 类型 | 描述 |
---|---|---|
shapeType | ShapeType | 形状的 ShapeType 。 |
x | Single | 形状框左侧的 X 坐标。 |
y | Single | 形状框上侧的 Y 坐标。 |
width | Single | 形状框的宽度。 |
height | Single | 形状框的高度。 |
返回值
创建的形状的零基索引。
创建的连接器对象。
示例
以下示例演示如何在 PowerPoint 演示文稿中在两个形状(一个椭圆和一个矩形)之间添加连接器(一个弯曲的连接器)。
[C#]
// Instantiates a presentation class that represents a PPTX file
using (Presentation input = new Presentation())
{
// Accesses the shapes collection for a specific slide
IShapeCollection shapes = input.Slides[0].Shapes;
// Adds an Ellipse autoshape
IAutoShape ellipse = shapes.AddAutoShape(ShapeType.Ellipse, 0, 100, 100, 100);
// Adds a Rectangle autoshape
IAutoShape rectangle = shapes.AddAutoShape(ShapeType.Rectangle, 100, 300, 100, 100);
// Adds a connector shape to the slide shape collection
IConnector connector = shapes.AddConnector(ShapeType.BentConnector2, 0, 0, 10, 10);
// Connects the shapes using the connector
connector.StartShapeConnectedTo = ellipse;
connector.EndShapeConnectedTo = rectangle;
// Calls reroute that sets the automatic shortest path between shapes
connector.Reroute();
// Saves the presentation
input.Save("Shapes-connector.pptx", SaveFormat.Pptx);
}
参见
- 接口 IConnector
- 枚举 ShapeType
- 类 ShapeCollection
- 命名空间 Aspose.Slides
- 程序集 Aspose.Slides
AddConnector(ShapeType, float, float, float, float, bool)
创建一个新的连接器并将其添加到集合的末尾。
public IConnector AddConnector(ShapeType shapeType, float x, float y, float width, float height,
bool createFromTemplate)
参数 | 类型 | 描述 |
---|---|---|
shapeType | ShapeType | 形状的 ShapeType 。 |
x | Single | 形状框左侧的 X 坐标。 |
y | Single | 形状框上侧的 Y 坐标。 |
width | Single | 形状框的宽度。 |
height | Single | 形状框的高度。 |
createFromTemplate | Boolean | 如果为 true,则新形状将从默认模板调整。将分配非空名称、简单样式和居中文本给新形状。如果为 false,则新形状的所有属性值将采用默认值。 |
返回值
创建的形状的零基索引。
创建的连接器对象。
参见
- 接口 IConnector
- 枚举 ShapeType
- 类 ShapeCollection
- 命名空间 Aspose.Slides
- 程序集 Aspose.Slides