officefileapi-devexpress-dot-docs-dot-presentation-dot-connectorshape-d344b5bd.md
Gets or sets the connector shape type.
Namespace : DevExpress.Docs.Presentation
Assembly : DevExpress.Docs.Presentation.v25.2.dll
NuGet Package : DevExpress.Docs.Presentation
public ConnectorShapeType Type { get; set; }
Public Property Type As ConnectorShapeType
| Type | Description |
|---|---|
| ConnectorShapeType |
The connector shape type.
|
Available values:
| Name | Description | Image |
|---|---|---|
| Line |
A straight connector.
|
| | Elbow |
An elbow connector.
|
| | ElbowWithHandle |
An elbow connector with one handle.
|
| | ElbowWith2Handles |
An elbow connector with two handles.
|
| | ElbowWith3Handles |
An elbow connector with three handles.
|
| | Curved |
A curved connector.
|
| | CurvedWithHandle |
A curved connector with one handle.
|
| | CurvedWith2Handles |
A curved connector with two handles.
|
| | CurvedWith3Handles |
A curved connector with three handles.
|
|
When changing connector settings, the connector type may be automatically simplified (the number of handles may be reduced) depending on the positions of the start and end shapes and their connection sites. For example, a curved connector with three handles might be converted to one with a single handle.
The following code snippet adds a connector between two shapes:
using DevExpress.Docs.Presentation;
using System.Drawing;
namespace PresentationApiSample;
public class Program {
public static void Main(string[] _) {
//...
Shape shape1 = new Shape(ShapeType.Rectangle);
shape1.Outline = new OutlineStyle { Fill = new SolidFill(Color.DarkGreen), Width = 8 };
shape1.X = 30;
shape1.Y = 30;
shape1.Width = 800;
shape1.Height = 800;
slide.Shapes.Add(shape1);
Shape shape2 = new Shape(ShapeType.Rectangle);
shape2.Outline = new OutlineStyle { Fill = new SolidFill(Color.DarkGreen), Width = 8 };
shape2.X = 1200;
shape2.Y = 1200;
shape2.Width = 800;
shape2.Height = 800;
slide.Shapes.Add(shape2);
ConnectorShape connector = new ConnectorShape();
connector.StartShape = shape1;
connector.EndShape = shape2;
connector.StartShapeSiteIndex = 2;
connector.EndShapeSiteIndex = 0;
connector.Type = ConnectorShapeType.Curved;
connector.Outline = new LineStyle {
Fill = new SolidFill(Color.Red),
Width = 6,
EndArrowType = ArrowType.TriangleArrow,
EndLength = ArrowSize.Large,
EndWidth = ArrowSize.Large
};
slide.Shapes.Add(connector);
}
}
Imports DevExpress.Docs.Presentation
Imports System.Drawing
Namespace PresentationApiSample
Public Class Program
Public Shared Sub Main(__ As String())
' ...
Dim shape1 As Shape = New Shape(ShapeType.Rectangle)
shape1.Outline = New OutlineStyle With {
.Fill = New SolidFill(Color.DarkGreen),
.Width = 8
}
shape1.X = 30
shape1.Y = 30
shape1.Width = 800
shape1.Height = 800
slide.Shapes.Add(shape1)
Dim shape2 As Shape = New Shape(ShapeType.Rectangle)
shape2.Outline = New OutlineStyle With {
.Fill = New SolidFill(Color.DarkGreen),
.Width = 8
}
shape2.X = 1200
shape2.Y = 1200
shape2.Width = 800
shape2.Height = 800
slide.Shapes.Add(shape2)
Dim connector As ConnectorShape = New ConnectorShape()
connector.StartShape = shape1
connector.EndShape = shape2
connector.StartShapeSiteIndex = 2
connector.EndShapeSiteIndex = 0
connector.Type = ConnectorShapeType.Curved
connector.Outline = New LineStyle With {
.Fill = New SolidFill(Color.Red),
.Width = 6,
.EndArrowType = ArrowType.TriangleArrow,
.EndLength = ArrowSize.Large,
.EndWidth = ArrowSize.Large
}
slide.Shapes.Add(connector)
End Sub
End Class
End Namespace
See Also