AddConnector
Contents
[
Hide
]AddConnector(ShapeType, float, float, float, float)
Creates a new Connector, tunes it from default template and adds it to the end of the collection.
public IConnector AddConnector(ShapeType shapeType, float x, float y, float width, float height)
Parameter | Type | Description |
---|---|---|
shapeType | ShapeType | The ShapeType of shape. |
x | Single | The X-coordinate for a left side of shape’s frame. |
y | Single | The Y-coordinate for a top side of shape’s frame. |
width | Single | The width of shape’s frame. |
height | Single | The height of shape’s frame. |
Return Value
The zero-based index of the created shape.
Created Connector object.
Examples
The following example shows how to add a connector (a bent connector) between two shapes (an ellipse and rectangle) in PowerPoint Presentation.
[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);
}
See Also
- interface IConnector
- enum ShapeType
- class ShapeCollection
- namespace Aspose.Slides
- assembly Aspose.Slides
AddConnector(ShapeType, float, float, float, float, bool)
Creates a new Connector and adds it to the end of the collection.
public IConnector AddConnector(ShapeType shapeType, float x, float y, float width, float height,
bool createFromTemplate)
Parameter | Type | Description |
---|---|---|
shapeType | ShapeType | The ShapeType of shape. |
x | Single | The X-coordinate for a left side of shape’s frame. |
y | Single | The Y-coordinate for a top side of shape’s frame. |
width | Single | The width of shape’s frame. |
height | Single | The height of shape’s frame. |
createFromTemplate | Boolean | If true then new shape will be tuned from default template. Not empty name, simple style, text centered will be assined to the new shape. If false then all values of the properties of the new shape will have default values. |
Return Value
The zero-based index of the created shape.
Created Connector object.
See Also
- interface IConnector
- enum ShapeType
- class ShapeCollection
- namespace Aspose.Slides
- assembly Aspose.Slides